usersAttempts) {
+ this.usersAttempts = usersAttempts;
+ }
+
+ public int compareTo(Object o) {
+ McMonitoredUserDTO mcMonitoredUserDTO = (McMonitoredUserDTO) o;
+
+ if (mcMonitoredUserDTO == null)
+ return 1;
+ else
+ return (int) (new Long(queUsrId).longValue() - new Long(mcMonitoredUserDTO.queUsrId).longValue());
+ }
+
+ /**
+ * @return Returns the attemptTime.
+ */
+ public String getAttemptTime() {
+ return attemptTime;
+ }
+
+ /**
+ * @param attemptTime
+ * The attemptTime to set.
+ */
+ public void setAttemptTime(String attemptTime) {
+ this.attemptTime = attemptTime;
+ }
+
+ /**
+ * @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 mark.
*/
public Integer getMark() {
- return mark;
+ return mark;
}
+
/**
- * @param mark The mark to set.
+ * @param mark
+ * The mark to set.
*/
public void setMark(Integer mark) {
- this.mark = mark;
+ this.mark = mark;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQuestionContentDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McQuestionContentDTO.java,v
diff -u -r1.1 -r1.2
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQuestionContentDTO.java 2 Oct 2006 02:06:35 -0000 1.1
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McQuestionContentDTO.java 8 May 2013 13:18:26 -0000 1.2
@@ -23,133 +23,144 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc;
+import java.util.List;
+
import org.apache.commons.lang.builder.ToStringBuilder;
-import java.util.List;
-
/**
- * 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 McQuestionContentDTO implements Comparable
-{
+public class McQuestionContentDTO implements Comparable {
private String question;
private String displayOrder;
private String feedback;
private String weight;
private String mark;
-
+
private String caCount;
private List listCandidateAnswersDTO;
-
- public String toString() {
- return new ToStringBuilder(this)
- .append("question:", question)
- .append("feedback:", feedback)
- .append("weight:", weight)
- .append("caCount:", caCount)
- .append("displayOrder:", displayOrder)
- .append("mark:", mark)
- .append("listCandidateAnswersDTO:", listCandidateAnswersDTO)
- .toString();
+
+ public String toString() {
+ return new ToStringBuilder(this).append("question:", question).append("feedback:", feedback)
+ .append("weight:", weight).append("caCount:", caCount).append("displayOrder:", displayOrder)
+ .append("mark:", mark).append("listCandidateAnswersDTO:", listCandidateAnswersDTO).toString();
}
-
- public int compareTo(Object o)
- {
- McMonitoredUserDTO mcMonitoredUserDTO = (McMonitoredUserDTO) o;
-
- if (mcMonitoredUserDTO == null)
- return 1;
- else
- return 0;
+
+ public int compareTo(Object o) {
+ McMonitoredUserDTO mcMonitoredUserDTO = (McMonitoredUserDTO) o;
+
+ if (mcMonitoredUserDTO == null)
+ return 1;
+ else
+ return 0;
}
+
/**
* @return Returns the displayOrder.
*/
public String getDisplayOrder() {
- return displayOrder;
+ return displayOrder;
}
+
/**
- * @param displayOrder The displayOrder to set.
+ * @param displayOrder
+ * The displayOrder to set.
*/
public void setDisplayOrder(String displayOrder) {
- this.displayOrder = displayOrder;
+ this.displayOrder = displayOrder;
}
+
/**
* @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 question.
*/
public String getQuestion() {
- return question;
+ return question;
}
+
/**
- * @param question The question to set.
+ * @param question
+ * The question to set.
*/
public void setQuestion(String question) {
- this.question = question;
+ this.question = question;
}
-
+
/**
* @return Returns the weight.
*/
public String getWeight() {
- return weight;
+ return weight;
}
+
/**
- * @param weight The weight to set.
+ * @param weight
+ * The weight to set.
*/
public void setWeight(String weight) {
- this.weight = weight;
+ this.weight = weight;
}
-
+
/**
* @return Returns the mark.
*/
public String getMark() {
- return mark;
+ return mark;
}
+
/**
- * @param mark The mark to set.
+ * @param mark
+ * The mark to set.
*/
public void setMark(String mark) {
- this.mark = mark;
+ this.mark = mark;
}
+
/**
* @return Returns the listCandidateAnswersDTO.
*/
public List getListCandidateAnswersDTO() {
- return listCandidateAnswersDTO;
+ return listCandidateAnswersDTO;
}
+
/**
- * @param listCandidateAnswersDTO The listCandidateAnswersDTO to set.
+ * @param listCandidateAnswersDTO
+ * The listCandidateAnswersDTO to set.
*/
public void setListCandidateAnswersDTO(List listCandidateAnswersDTO) {
- this.listCandidateAnswersDTO = listCandidateAnswersDTO;
+ this.listCandidateAnswersDTO = listCandidateAnswersDTO;
}
-
+
/**
* @return Returns the caCount.
*/
public String getCaCount() {
- return caCount;
+ return caCount;
}
+
/**
- * @param caCount The caCount to set.
+ * @param caCount
+ * The caCount to set.
*/
public void setCaCount(String caCount) {
- this.caCount = caCount;
+ this.caCount = caCount;
}
- }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McRandomizedListsDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McRandomizedListsDTO.java,v
diff -u -r1.1 -r1.2
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McRandomizedListsDTO.java 17 Nov 2006 11:13:04 -0000 1.1
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McRandomizedListsDTO.java 8 May 2013 13:18:25 -0000 1.2
@@ -24,54 +24,53 @@
import java.util.List;
-
-
-
/**
- * DTO that holds randomized lists
+ *
+ * DTO that holds randomized lists
*
*
* @author Ozgur Demirtas
*/
-public class McRandomizedListsDTO implements Comparable
-{
+public class McRandomizedListsDTO implements Comparable {
List listCandidateAnswers;
List listCandidateAnswerUids;
-
-
- public int compareTo(Object o)
- {
- McRandomizedListsDTO mcRandomizedListsDTO = (McRandomizedListsDTO) o;
-
- if (mcRandomizedListsDTO == null)
- return 1;
- else
- return 0;
+
+ public int compareTo(Object o) {
+ McRandomizedListsDTO mcRandomizedListsDTO = (McRandomizedListsDTO) o;
+
+ if (mcRandomizedListsDTO == null)
+ return 1;
+ else
+ return 0;
}
-
-
+
/**
* @return Returns the listCandidateAnswers.
*/
public List getListCandidateAnswers() {
- return listCandidateAnswers;
+ return listCandidateAnswers;
}
+
/**
- * @param listCandidateAnswers The listCandidateAnswers to set.
+ * @param listCandidateAnswers
+ * The listCandidateAnswers to set.
*/
public void setListCandidateAnswers(List listCandidateAnswers) {
- this.listCandidateAnswers = listCandidateAnswers;
+ this.listCandidateAnswers = listCandidateAnswers;
}
+
/**
* @return Returns the listCandidateAnswerUids.
*/
public List getListCandidateAnswerUids() {
- return listCandidateAnswerUids;
+ return listCandidateAnswerUids;
}
+
/**
- * @param listCandidateAnswerUids The listCandidateAnswerUids to set.
+ * @param listCandidateAnswerUids
+ * The listCandidateAnswerUids to set.
*/
public void setListCandidateAnswerUids(List listCandidateAnswerUids) {
- this.listCandidateAnswerUids = listCandidateAnswerUids;
+ this.listCandidateAnswerUids = listCandidateAnswerUids;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSessionMarkDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSessionMarkDTO.java,v
diff -u -r1.2 -r1.3
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSessionMarkDTO.java 17 Sep 2006 06:23:44 -0000 1.2
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McSessionMarkDTO.java 8 May 2013 13:18:25 -0000 1.3
@@ -26,75 +26,74 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
- * DTO that hols session user marks
+ *
+ * DTO that hols session user marks
*
*
* @author Ozgur Demirtas
*/
-public class McSessionMarkDTO implements Comparable
-{
+public class McSessionMarkDTO implements Comparable {
private String sessionId;
private String sessionName;
- private Map userMarks;
-
+ private Map userMarks;
+
public String toString() {
- return new ToStringBuilder(this)
- .append("Listing SessionMarkDTO: ")
- .append("sessionId: ", sessionId)
- .append("sessionName: ", sessionName)
- .append("userMarks: ", userMarks)
- .toString();
+ return new ToStringBuilder(this).append("Listing SessionMarkDTO: ").append("sessionId: ", sessionId)
+ .append("sessionName: ", sessionName).append("userMarks: ", userMarks).toString();
}
-
-
- public int compareTo(Object o)
- {
- McSessionMarkDTO mcSessionMarkDTO = (McSessionMarkDTO) o;
-
- if (mcSessionMarkDTO == null)
- return 1;
- else
- return (int) (new Long(sessionId).longValue() - new Long(mcSessionMarkDTO.sessionId).longValue());
+
+ public int compareTo(Object o) {
+ McSessionMarkDTO mcSessionMarkDTO = (McSessionMarkDTO) o;
+
+ if (mcSessionMarkDTO == null)
+ return 1;
+ else
+ return (int) (new Long(sessionId).longValue() - new Long(mcSessionMarkDTO.sessionId).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;
}
+
/**
* @return Returns the userMarks.
*/
public Map getUserMarks() {
- return userMarks;
+ return userMarks;
}
+
/**
- * @param userMarks The userMarks to set.
+ * @param userMarks
+ * The userMarks to set.
*/
public void setUserMarks(Map userMarks) {
- this.userMarks = userMarks;
+ this.userMarks = userMarks;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java,v
diff -u -r1.6 -r1.7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java 17 Sep 2006 06:23:44 -0000 1.6
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStringComparator.java 8 May 2013 13:18:25 -0000 1.7
@@ -28,22 +28,21 @@
import org.apache.log4j.Logger;
/**
- * @author Ozgur Demirtas
- * * A comparator implementation that can be used as a constructor to collections.
- * The TreeMap in the web layer makes use of it.
+ * @author Ozgur Demirtas * A comparator implementation that can be used as a constructor to collections. The TreeMap in
+ * the web layer makes use of it.
*
*/
public class McStringComparator implements Comparator, Serializable {
- static Logger logger = Logger.getLogger(McStringComparator.class.getName());
-
- public int compare(Object o1, Object o2) {
- String s1 = (String)o1;
- String s2 = (String)o2;
+ static Logger logger = Logger.getLogger(McStringComparator.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) {
- return compare(this, o)==0;
- }
+ return s1.compareTo(s2);
+ }
+
+ public boolean equals(Object o) {
+ return compare(this, o) == 0;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McTempDataHolderDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McTempDataHolderDTO.java,v
diff -u -r1.6 -r1.7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McTempDataHolderDTO.java 15 Aug 2007 03:54:49 -0000 1.6
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McTempDataHolderDTO.java 8 May 2013 13:18:25 -0000 1.7
@@ -24,73 +24,74 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
-
/**
- * DTO that holds temporary data
+ *
+ * DTO that holds temporary data
*
*
* @author Ozgur Demirtas
*/
-public class McTempDataHolderDTO implements Comparable
-{
+public class McTempDataHolderDTO implements Comparable {
protected Integer learnerMark;
protected Integer totalMarksPossible;
protected Integer displayOrder;
-
- public int compareTo(Object o)
- {
- McTempDataHolderDTO mcTempDataHolderDTO = (McTempDataHolderDTO) o;
-
- if (mcTempDataHolderDTO == null)
- return 1;
- else
- return 0;
+ public int compareTo(Object o) {
+ McTempDataHolderDTO mcTempDataHolderDTO = (McTempDataHolderDTO) o;
+
+ if (mcTempDataHolderDTO == null)
+ return 1;
+ else
+ return 0;
}
- public String toString() {
- return new ToStringBuilder(this)
- .append("learnerMark: ", learnerMark)
- .append("totalMarksPossible : ", totalMarksPossible)
- .append("displayOrder : ", displayOrder)
- .toString();
+ public String toString() {
+ return new ToStringBuilder(this).append("learnerMark: ", learnerMark)
+ .append("totalMarksPossible : ", totalMarksPossible).append("displayOrder : ", displayOrder).toString();
}
-
+
/**
* @return Returns the learnerMark.
*/
public Integer getLearnerMark() {
- return learnerMark;
+ return learnerMark;
}
+
/**
- * @param learnerMark The learnerMark to set.
+ * @param learnerMark
+ * The learnerMark to set.
*/
public void setLearnerMark(Integer learnerMark) {
- this.learnerMark = learnerMark;
+ this.learnerMark = learnerMark;
}
+
/**
* @return Returns the totalMarksPossible.
*/
public Integer getTotalMarksPossible() {
- return totalMarksPossible;
+ return totalMarksPossible;
}
+
/**
- * @param totalMarksPossible The totalMarksPossible to set.
+ * @param totalMarksPossible
+ * The totalMarksPossible to set.
*/
public void setTotalMarksPossible(Integer totalMarksPossible) {
- this.totalMarksPossible = totalMarksPossible;
+ this.totalMarksPossible = totalMarksPossible;
}
+
/**
* @return Returns the displayOrder.
*/
public Integer getDisplayOrder() {
- return displayOrder;
+ return displayOrder;
}
+
/**
- * @param displayOrder The displayOrder to set.
+ * @param displayOrder
+ * The displayOrder to set.
*/
public void setDisplayOrder(Integer displayOrder) {
- this.displayOrder = displayOrder;
+ this.displayOrder = displayOrder;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUserMarkDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUserMarkDTO.java,v
diff -u -r1.6 -r1.7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUserMarkDTO.java 28 Oct 2008 05:10:19 -0000 1.6
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUserMarkDTO.java 8 May 2013 13:18:25 -0000 1.7
@@ -26,148 +26,155 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
- * DTO that hols user marks
+ *
+ * DTO that hols user marks
*
*
* @author Ozgur Demirtas
*/
-public class McUserMarkDTO implements Comparable
-{
+public class McUserMarkDTO implements Comparable {
private String sessionId;
private String sessionName;
private String queUsrId;
private String userName;
private String fullName;
private Date attemptTime;
- private Integer[] marks;
+ private Integer[] marks;
private Long totalMark;
- public String toString() {
- return new ToStringBuilder(this)
- .append("Listing UserMarkDTO:")
- .append("sessionId", sessionId)
- .append("queUsrId", queUsrId)
- .append("userName", userName)
- .append("fullName", fullName)
- .append("marks", marks)
- .append("totalMark", totalMark)
- .append("attemptTime", attemptTime)
- .toString();
+ public String toString() {
+ return new ToStringBuilder(this).append("Listing UserMarkDTO:").append("sessionId", sessionId)
+ .append("queUsrId", queUsrId).append("userName", userName).append("fullName", fullName)
+ .append("marks", marks).append("totalMark", totalMark).append("attemptTime", attemptTime).toString();
}
-
/**
* @return Returns the marks.
*/
public Integer[] getMarks() {
- return marks;
+ return marks;
}
+
/**
- * @param marks The marks to set.
+ * @param marks
+ * The marks to set.
*/
public void setMarks(Integer[] marks) {
- this.marks = marks;
+ this.marks = marks;
}
+
/**
* @return Returns the queUsrId.
*/
public String getQueUsrId() {
- return queUsrId;
+ return queUsrId;
}
-
+
/**
- * @param queUsrId The queUsrId to set.
+ * @param queUsrId
+ * The queUsrId to set.
*/
public void setQueUsrId(String queUsrId) {
- this.queUsrId = queUsrId;
+ this.queUsrId = queUsrId;
}
-
+
/**
* @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 userName.
*/
public String getFullName() {
- return fullName;
+ return fullName;
}
-
+
/**
- * @param userName The userName to set.
+ * @param userName
+ * The userName to set.
*/
public void setFullName(String fullName) {
- this.fullName = fullName;
+ this.fullName = fullName;
}
-
- public int compareTo(Object o)
- {
- McUserMarkDTO mcUserMarkDTO = (McUserMarkDTO) o;
-
- if (mcUserMarkDTO == null)
- return 1;
- else
- return (int) (new Long(queUsrId).longValue() - new Long(mcUserMarkDTO.queUsrId).longValue());
+
+ public int compareTo(Object o) {
+ McUserMarkDTO mcUserMarkDTO = (McUserMarkDTO) o;
+
+ if (mcUserMarkDTO == null)
+ return 1;
+ else
+ return (int) (new Long(queUsrId).longValue() - new Long(mcUserMarkDTO.queUsrId).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 totalMark.
*/
public Long getTotalMark() {
- return totalMark;
+ return totalMark;
}
+
/**
- * @param totalMark The totalMark to set.
+ * @param totalMark
+ * The totalMark to set.
*/
public void setTotalMark(Long totalMark) {
- this.totalMark = totalMark;
+ this.totalMark = totalMark;
}
+
/**
* @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 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;
- }
+ public void setAttemptTime(Date attemptTime) {
+ this.attemptTime = attemptTime;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java,v
diff -u -r1.56 -r1.57
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 8 May 2013 13:03:18 -0000 1.56
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 8 May 2013 13:18:25 -0000 1.57
@@ -34,7 +34,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.log4j.Logger;
import org.lamsfoundation.lams.tool.mc.pojos.McContent;
import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent;
import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile;
@@ -46,554 +45,509 @@
import org.lamsfoundation.lams.web.util.AttributeNames;
import org.lamsfoundation.lams.web.util.SessionMap;
-
/**
- * @author Ozgur Demirtas
- * Common MCQ utility functions live here.
+ * @author Ozgur Demirtas Common MCQ utility functions live here.
*/
public abstract class McUtils implements McAppConstants {
- public static String replaceNewLines(String text)
- {
- String newText = "";
- if (text != null)
- {
- newText = text.replaceAll("\n","
");
- }
-
- return newText;
+ public static String replaceNewLines(String text) {
+ String newText = "";
+ if (text != null) {
+ newText = text.replaceAll("\n", "
");
+ }
+ return newText;
+
}
+ /**
+ *
+ * @param request
+ * @return
+ */
+ /* fix this */
+ public static Date getGMTDateTime() {
+ Date date = new Date(System.currentTimeMillis());
+ return date;
+ }
- /**
- *
- * @param request
- * @return
- */
- /* fix this */
- public static Date getGMTDateTime()
- {
- Date date=new Date(System.currentTimeMillis());
- return date;
+ public static UserDTO getToolUser() {
+ /* obtain user object from the session */
+ HttpSession ss = SessionManager.getSession();
+ /* get back login user DTO */
+ UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return toolUser;
}
-
- public static UserDTO getToolUser()
- {
- /*obtain user object from the session*/
- HttpSession ss = SessionManager.getSession();
- /* get back login user DTO */
- UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
- return toolUser;
- }
-
-
- public static Long getUserId()
- {
- UserDTO toolUser=getToolUser();
- long userId=toolUser.getUserID().longValue();
- return new Long(userId);
- }
-
- public static String getUserName()
- {
- /* double check if username and login is the same */
- UserDTO toolUser=getToolUser();
- String userName=toolUser.getLogin();
- return userName;
- }
-
- public static String getUserFullName()
- {
- UserDTO toolUser=getToolUser();
- String fullName=toolUser.getFirstName() + " " + toolUser.getLastName();
- return fullName;
- }
-
- public static String getFormattedDateString(Date date)
- {
- return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date));
- }
-
-
-
-
- /**
- * generateOptionsMap(List listMcOptions)
- *
- * returns a Map of options
- *
- * @param listMcOptions
- * @return Map
- */
- public static Map generateOptionsMap(List listMcOptions)
- {
- Map mapOptionsContent= new TreeMap(new McStringComparator());
-
- Iterator listIterator=listMcOptions.iterator();
- Long mapIndex=new Long(1);
- while (listIterator.hasNext())
- {
- McOptsContent mcOptionsContent = (McOptsContent)listIterator.next();
- mapOptionsContent.put(mapIndex.toString(),mcOptionsContent.getMcQueOptionText());
- mapIndex=new Long(mapIndex.longValue()+1);
- }
- return mapOptionsContent;
- }
+ public static Long getUserId() {
+ UserDTO toolUser = getToolUser();
+ long userId = toolUser.getUserID().longValue();
+ return new Long(userId);
+ }
- public static void configureContentRepository(HttpServletRequest request, IMcService mcService)
- {
- mcService.configureContentRepository();
+ public static String getUserName() {
+ /* double check if username and login is the same */
+ UserDTO toolUser = getToolUser();
+ String userName = toolUser.getLogin();
+ return userName;
+ }
+
+ public static String getUserFullName() {
+ UserDTO toolUser = getToolUser();
+ String fullName = toolUser.getFirstName() + " " + toolUser.getLastName();
+ return fullName;
+ }
+
+ public static String getFormattedDateString(Date date) {
+ return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date));
+ }
+
+ /**
+ * generateOptionsMap(List listMcOptions)
+ *
+ * returns a Map of options
+ *
+ * @param listMcOptions
+ * @return Map
+ */
+ public static Map generateOptionsMap(List listMcOptions) {
+ Map mapOptionsContent = new TreeMap(new McStringComparator());
+
+ Iterator listIterator = listMcOptions.iterator();
+ Long mapIndex = new Long(1);
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptionsContent = (McOptsContent) listIterator.next();
+ mapOptionsContent.put(mapIndex.toString(), mcOptionsContent.getMcQueOptionText());
+ mapIndex = new Long(mapIndex.longValue() + 1);
}
-
+ return mapOptionsContent;
+ }
+
+ public static void configureContentRepository(HttpServletRequest request, IMcService mcService) {
+ mcService.configureContentRepository();
+ }
+
/**
* temporary function
+ *
* @return
*/
- public static long generateId()
- {
- Random generator = new Random();
- long longId=generator.nextLong();
- if (longId < 0) longId=longId * (-1) ;
- return longId;
- }
-
+ public static long generateId() {
+ Random generator = new Random();
+ long longId = generator.nextLong();
+ if (longId < 0)
+ longId = longId * (-1);
+ return longId;
+ }
+
/**
* temporary function
+ *
* @return
*/
- public static int generateIntegerId()
- {
- Random generator = new Random();
- int intId=generator.nextInt();
- if (intId < 0) intId=intId * (-1) ;
- return intId;
- }
-
+ public static int generateIntegerId() {
+ Random generator = new Random();
+ int intId = generator.nextInt();
+ if (intId < 0)
+ intId = intId * (-1);
+ return intId;
+ }
/**
* temporary function
+ *
* @return
*/
- public static int getCurrentUserId(HttpServletRequest request) throws McApplicationException
- {
- HttpSession ss = SessionManager.getSession();
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- return user.getUserID().intValue();
+ public static int getCurrentUserId(HttpServletRequest request) throws McApplicationException {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return user.getUserID().intValue();
}
-
/**
* temporary function
+ *
* @return
*/
- public static User createSimpleUser(Integer userId)
- {
- User user=new User();
- user.setUserId(userId);
- return user;
+ public static User createSimpleUser(Integer userId) {
+ User user = new User();
+ user.setUserId(userId);
+ return user;
+ }
+
+ /**
+ * find out if the content is in use or not. If it is in use, the author can not modify it. The idea of content
+ * being in use is, once any one learner starts using a particular content that content should become unmodifiable.
+ *
+ * @param mcContent
+ * @return boolean
+ */
+ public static boolean isContentInUse(McContent mcContent) {
+ return mcContent.isContentInUse();
+ }
+
+ /**
+ * find out if the content is being edited in monitoring interface or not. If it is, the author can not modify it.
+ *
+ * @param mcContent
+ * @return boolean
+ */
+ public static boolean isDefineLater(McContent mcContent) {
+ return mcContent.isDefineLater();
+ }
+
+ /**
+ * find out if the content is set to run offline or online. If it is set to run offline , the learners are informed
+ * about that..
+ *
+ * @param mcContent
+ * @return boolean
+ */
+ public static boolean isRunOffline(McContent mcContent) {
+ return mcContent.isRunOffline();
+ }
+
+ /**
+ * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID and CURRENT_MONITORED_TOOL_SESSION
+ * cleanUpSessionAbsolute(HttpServletRequest request)
+ *
+ * @param request
+ */
+ public static void cleanUpSessionAbsolute(HttpServletRequest request) {
+ request.getSession().removeAttribute(MY_SIGNATURE);
+ request.getSession().removeAttribute(DEFAULT_CONTENT_ID);
+ request.getSession().removeAttribute(ERROR_MCAPPLICATION);
+ request.getSession().removeAttribute(LOAD);
+ request.getSession().removeAttribute(LOAD_QUESTIONS);
+ request.getSession().removeAttribute(LOAD_STARTER);
+ request.getSession().removeAttribute(AUTHORING_STARTER);
+ request.getSession().removeAttribute(LEARNING_STARTER);
+ request.getSession().removeAttribute(MONITORING_STARTER);
+ request.getSession().removeAttribute(LOAD_LEARNER);
+ request.getSession().removeAttribute(LOAD_MONITORING_CONTENT);
+ request.getSession().removeAttribute(INDIVIDUAL_REPORT);
+ request.getSession().removeAttribute(REDO_QUESTIONS);
+ request.getSession().removeAttribute(SINGLE_QUESTION_ANSWERS);
+ request.getSession().removeAttribute(ERROR_LIST);
+ request.getSession().removeAttribute(PREVIEW);
+ request.getSession().removeAttribute(LEARNER_PROGRESS);
+ request.getSession().removeAttribute(LEARNER_PROGRESS_USERID);
+ request.getSession().removeAttribute(AUTHORING);
+ request.getSession().removeAttribute(SOURCE_MC_STARTER);
+ request.getSession().removeAttribute(AUTHORING_CANCELLED);
+ request.getSession().removeAttribute(DEFINE_LATER_EDIT_ACTIVITY);
+ request.getSession().removeAttribute(EDIT_OPTIONS_MODE);
+ request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE);
+ request.getSession().removeAttribute(IS_ADD_QUESTION);
+ request.getSession().removeAttribute(IS_REMOVE_QUESTION);
+ request.getSession().removeAttribute(SUBMIT_SUCCESS);
+ request.getSession().removeAttribute(MAP_QUESTIONS_CONTENT);
+ request.getSession().removeAttribute(IS_REMOVE_CONTENT);
+ request.getSession().removeAttribute(IS_REVISITING_USER);
+ request.getSession().removeAttribute(USER);
+ request.getSession().removeAttribute(TOOL_CONTENT_UID);
+ request.getSession().removeAttribute(TOOL_SESSION_ID);
+ request.getSession().removeAttribute(USER_ID);
+ request.getSession().removeAttribute(MAX_QUESTION_INDEX);
+ request.getSession().removeAttribute(COPY_TOOL_CONTENT);
+ request.getSession().removeAttribute(REMOVE_TOOL_CONTENT);
+ request.getSession().removeAttribute(MAP_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_DEFAULTOPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_DISABLED_QUESTIONS);
+ request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_QUEID);
+ request.getSession().removeAttribute(QUESTIONS_WITHNO_OPTIONS);
+ request.getSession().removeAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_LEARNER_QUESTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_LEARNER_CHECKED_OPTIONS_CONTENT);
+ request.getSession().removeAttribute(MAP_LEARNER_ASSESSMENT_RESULTS);
+ request.getSession().removeAttribute(MAP_LEARNER_FEEDBACK_INCORRECT);
+ request.getSession().removeAttribute(MAP_LEARNER_FEEDBACK_CORRECT);
+ request.getSession().removeAttribute(MAP_QUESTION_WEIGHTS);
+ request.getSession().removeAttribute(MAP_QUE_ATTEMPTS);
+ request.getSession().removeAttribute(MAP_QUE_CORRECT_ATTEMPTS);
+ request.getSession().removeAttribute(MAP_QUE_INCORRECT_ATTEMPTS);
+ request.getSession().removeAttribute(MAP_WEIGHTS);
+ request.getSession().removeAttribute(MAP_CHECKBOX_STATES);
+ request.getSession().removeAttribute(MAP_SELECTED_OPTIONS);
+ request.getSession().removeAttribute(MAP_FEEDBACK_INCORRECT);
+ request.getSession().removeAttribute(MAP_FEEDBACK_CORRECT);
+ request.getSession().removeAttribute(SELECTED_QUESTION);
+ request.getSession().removeAttribute(SELECTED_QUESTION_INDEX);
+ request.getSession().removeAttribute(DEFAULT_QUESTION_UID);
+ request.getSession().removeAttribute(TITLE);
+ request.getSession().removeAttribute(INSTRUCTIONS);
+ request.getSession().removeAttribute(CREATION_DATE);
+ request.getSession().removeAttribute(DEFINE_LATER);
+ request.getSession().removeAttribute(RICHTEXT_FEEDBACK_CORRECT);
+ request.getSession().removeAttribute(RETRIES);
+ request.getSession().removeAttribute(ON);
+ request.getSession().removeAttribute(OFF);
+ request.getSession().removeAttribute(RICHTEXT_FEEDBACK_INCORRECT);
+ request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(PASSMARK);
+ request.getSession().removeAttribute(VIEW_ANSWERS);
+ request.getSession().removeAttribute(SHOW_AUTHORING_TABS);
+ request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_REPORT_TITLE);
+ // request.getSession().removeAttribute(RICHTEXT_END_LEARNING_MSG);
+ 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(LIST_UPLOADED_OFFLINE_FILENAMES);
+ request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES);
+ request.getSession().removeAttribute(LIST_OFFLINEFILES_METADATA);
+ request.getSession().removeAttribute(LIST_ONLINEFILES_METADATA);
+ request.getSession().removeAttribute(COUNT_SESSION_COMPLETE);
+ request.getSession().removeAttribute(COUNT_ALL_USERS);
+ request.getSession().removeAttribute(COUNT_MAX_ATTEMPT);
+ request.getSession().removeAttribute(TOP_MARK);
+ request.getSession().removeAttribute(LOWEST_MARK);
+ request.getSession().removeAttribute(AVERAGE_MARK);
+ request.getSession().removeAttribute(ACTIVE_MODULE);
+ 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(ADD_NEW_QUESTION);
+ request.getSession().removeAttribute(OPTION_OFF);
+ 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(MAP_QUESTION_CONTENT_LEARNER);
+ request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
+ request.getSession().removeAttribute(TOTAL_QUESTION_COUNT);
+ request.getSession().removeAttribute(LEARNER_MARK);
+ request.getSession().removeAttribute(MAP_ANSWERS);
+ request.getSession().removeAttribute(CURRENT_ANSWER);
+ request.getSession().removeAttribute(USER_FEEDBACK);
+ request.getSession().removeAttribute(REPORT_TITLE_LEARNER);
+ request.getSession().removeAttribute(TOTAL_COUNT_REACHED);
+ request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE);
+ request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
+ request.getSession().removeAttribute(IS_CONTENT_IN_USE);
+ request.getSession().removeAttribute(IS_RETRIES);
+ request.getSession().removeAttribute(IS_SHOW_FEEDBACK);
+ request.getSession().removeAttribute(IS_SHOW_LEARNERS_REPORT);
+ request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED);
+ 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(MAP_USER_RESPONSES);
+ request.getSession().removeAttribute(MAP_MAIN_REPORT);
+ request.getSession().removeAttribute(MAP_STATS);
+ request.getSession().removeAttribute(REPORT_TITLE_MONITOR);
+ request.getSession().removeAttribute(MONITOR_USER_ID);
+ request.getSession().removeAttribute(MONITORING_REPORT);
+ request.getSession().removeAttribute(MONITORING_ERROR);
+ request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS);
+ request.getSession().removeAttribute(MONITORED_CONTENT_ID);
+ request.getSession().removeAttribute(EDITACTIVITY_EDITMODE);
+ request.getSession().removeAttribute(FORM_INDEX);
+ request.getSession().removeAttribute(SELECTION_CASE);
+ request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED);
+ request.getSession().removeAttribute(PREVIEW_ONLY);
+ request.getSession().removeAttribute(TIMEZONE);
+ request.getSession().removeAttribute(MODE);
+ request.getSession().removeAttribute(LEARNING_MODE);
+ request.getSession().removeAttribute(EXPORT_USER_ID);
+ request.getSession().removeAttribute(MAP_INCORRECT_FEEDBACK);
+ request.getSession().removeAttribute(MAP_CORRECT_FEEDBACK);
+ request.getSession().removeAttribute(MAP_INCORRECT_FEEDBACK_LEARNER);
+ request.getSession().removeAttribute(MAP_CORRECT_FEEDBACK_LEARNER);
+ request.getSession().removeAttribute(ACTIVITY_TITLE);
+ request.getSession().removeAttribute(ACTIVITY_INSTRUCTIONS);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID);
+ }
+
+ /**
+ *
+ * determines the struts level location to return
+ *
+ * @param sourceMcStarter
+ * @param requestedModule
+ * @return
+ */
+ public static String getDestination(String sourceMcStarter, String requestedModule) {
+
+ if (requestedModule.equals(DEFINE_LATER)) {
+ // request is from define Later url. return to LOAD_VIEW_ONLY
+ return LOAD_VIEW_ONLY;
+ } else if (requestedModule.equals(AUTHORING)) {
+ // request is from authoring url. return to LOAD_QUESTIONS
+ return LOAD_QUESTIONS;
+ } else {
+ // request is from an unknown source. return null
+ return null;
}
-
- /**
- * find out if the content is in use or not. If it is in use, the author can not modify it.
- * The idea of content being in use is, once any one learner starts using a particular content
- * that content should become unmodifiable.
- *
- * @param mcContent
- * @return boolean
- */
- public static boolean isContentInUse(McContent mcContent)
- {
- return mcContent.isContentInUse();
- }
-
-
- /**
- * find out if the content is being edited in monitoring interface or not. If it is, the author can not modify it.
- *
- * @param mcContent
- * @return boolean
- */
- public static boolean isDefineLater(McContent mcContent)
- {
- return mcContent.isDefineLater();
- }
-
-
- /**
- * find out if the content is set to run offline or online. If it is set to run offline , the learners are informed about that..
- *
- * @param mcContent
- * @return boolean
- */
- public static boolean isRunOffline(McContent mcContent)
- {
- return mcContent.isRunOffline();
- }
-
-
-
- /**
- * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID and CURRENT_MONITORED_TOOL_SESSION
- * cleanUpSessionAbsolute(HttpServletRequest request)
- * @param request
- */
- public static void cleanUpSessionAbsolute(HttpServletRequest request)
- {
- request.getSession().removeAttribute(MY_SIGNATURE);
- request.getSession().removeAttribute(DEFAULT_CONTENT_ID);
- request.getSession().removeAttribute(ERROR_MCAPPLICATION);
- request.getSession().removeAttribute(LOAD);
- request.getSession().removeAttribute(LOAD_QUESTIONS);
- request.getSession().removeAttribute(LOAD_STARTER);
- request.getSession().removeAttribute(AUTHORING_STARTER);
- request.getSession().removeAttribute(LEARNING_STARTER);
- request.getSession().removeAttribute(MONITORING_STARTER);
- request.getSession().removeAttribute(LOAD_LEARNER);
- request.getSession().removeAttribute(LOAD_MONITORING_CONTENT);
- request.getSession().removeAttribute(INDIVIDUAL_REPORT);
- request.getSession().removeAttribute(REDO_QUESTIONS);
- request.getSession().removeAttribute(SINGLE_QUESTION_ANSWERS);
- request.getSession().removeAttribute(ERROR_LIST);
- request.getSession().removeAttribute(PREVIEW);
- request.getSession().removeAttribute(LEARNER_PROGRESS);
- request.getSession().removeAttribute(LEARNER_PROGRESS_USERID);
- request.getSession().removeAttribute(AUTHORING);
- request.getSession().removeAttribute(SOURCE_MC_STARTER);
- request.getSession().removeAttribute(AUTHORING_CANCELLED);
- request.getSession().removeAttribute(DEFINE_LATER_EDIT_ACTIVITY);
- request.getSession().removeAttribute(EDIT_OPTIONS_MODE);
- request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE);
- request.getSession().removeAttribute(IS_ADD_QUESTION);
- request.getSession().removeAttribute(IS_REMOVE_QUESTION);
- request.getSession().removeAttribute(SUBMIT_SUCCESS);
- request.getSession().removeAttribute(MAP_QUESTIONS_CONTENT);
- request.getSession().removeAttribute(IS_REMOVE_CONTENT);
- request.getSession().removeAttribute(IS_REVISITING_USER);
- request.getSession().removeAttribute(USER);
- request.getSession().removeAttribute(TOOL_CONTENT_UID);
- request.getSession().removeAttribute(TOOL_SESSION_ID);
- request.getSession().removeAttribute(USER_ID);
- request.getSession().removeAttribute(MAX_QUESTION_INDEX);
- request.getSession().removeAttribute(COPY_TOOL_CONTENT);
- request.getSession().removeAttribute(REMOVE_TOOL_CONTENT);
- request.getSession().removeAttribute(MAP_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_DEFAULTOPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_DISABLED_QUESTIONS);
- request.getSession().removeAttribute(MAP_GENERAL_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_STARTUP_GENERAL_OPTIONS_QUEID);
- request.getSession().removeAttribute(QUESTIONS_WITHNO_OPTIONS);
- request.getSession().removeAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_LEARNER_QUESTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_LEARNER_CHECKED_OPTIONS_CONTENT);
- request.getSession().removeAttribute(MAP_LEARNER_ASSESSMENT_RESULTS);
- request.getSession().removeAttribute(MAP_LEARNER_FEEDBACK_INCORRECT);
- request.getSession().removeAttribute(MAP_LEARNER_FEEDBACK_CORRECT);
- request.getSession().removeAttribute(MAP_QUESTION_WEIGHTS);
- request.getSession().removeAttribute(MAP_QUE_ATTEMPTS);
- request.getSession().removeAttribute(MAP_QUE_CORRECT_ATTEMPTS);
- request.getSession().removeAttribute(MAP_QUE_INCORRECT_ATTEMPTS);
- request.getSession().removeAttribute(MAP_WEIGHTS);
- request.getSession().removeAttribute(MAP_CHECKBOX_STATES);
- request.getSession().removeAttribute(MAP_SELECTED_OPTIONS);
- request.getSession().removeAttribute(MAP_FEEDBACK_INCORRECT);
- request.getSession().removeAttribute(MAP_FEEDBACK_CORRECT);
- request.getSession().removeAttribute(SELECTED_QUESTION);
- request.getSession().removeAttribute(SELECTED_QUESTION_INDEX);
- request.getSession().removeAttribute(DEFAULT_QUESTION_UID);
- request.getSession().removeAttribute(TITLE);
- request.getSession().removeAttribute(INSTRUCTIONS);
- request.getSession().removeAttribute(CREATION_DATE);
- request.getSession().removeAttribute(DEFINE_LATER);
- request.getSession().removeAttribute(RICHTEXT_FEEDBACK_CORRECT);
- request.getSession().removeAttribute(RETRIES);
- request.getSession().removeAttribute(ON);
- request.getSession().removeAttribute(OFF);
- request.getSession().removeAttribute(RICHTEXT_FEEDBACK_INCORRECT);
- request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
- request.getSession().removeAttribute(PASSMARK);
- request.getSession().removeAttribute(VIEW_ANSWERS);
- request.getSession().removeAttribute(SHOW_AUTHORING_TABS);
- request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS);
- request.getSession().removeAttribute(RICHTEXT_REPORT_TITLE);
- //request.getSession().removeAttribute(RICHTEXT_END_LEARNING_MSG);
- 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(LIST_UPLOADED_OFFLINE_FILENAMES);
- request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES);
- request.getSession().removeAttribute(LIST_OFFLINEFILES_METADATA);
- request.getSession().removeAttribute(LIST_ONLINEFILES_METADATA);
- request.getSession().removeAttribute(COUNT_SESSION_COMPLETE);
- request.getSession().removeAttribute(COUNT_ALL_USERS);
- request.getSession().removeAttribute(COUNT_MAX_ATTEMPT);
- request.getSession().removeAttribute(TOP_MARK);
- request.getSession().removeAttribute(LOWEST_MARK);
- request.getSession().removeAttribute(AVERAGE_MARK);
- request.getSession().removeAttribute(ACTIVE_MODULE);
- 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(ADD_NEW_QUESTION);
- request.getSession().removeAttribute(OPTION_OFF);
- 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(MAP_QUESTION_CONTENT_LEARNER);
- request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
- request.getSession().removeAttribute(TOTAL_QUESTION_COUNT);
- request.getSession().removeAttribute(LEARNER_MARK);
- request.getSession().removeAttribute(MAP_ANSWERS);
- request.getSession().removeAttribute(CURRENT_ANSWER);
- request.getSession().removeAttribute(USER_FEEDBACK);
- request.getSession().removeAttribute(REPORT_TITLE_LEARNER);
- request.getSession().removeAttribute(TOTAL_COUNT_REACHED);
- request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE);
- request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
- request.getSession().removeAttribute(IS_CONTENT_IN_USE);
- request.getSession().removeAttribute(IS_RETRIES);
- request.getSession().removeAttribute(IS_SHOW_FEEDBACK);
- request.getSession().removeAttribute(IS_SHOW_LEARNERS_REPORT);
- request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED);
- 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(MAP_USER_RESPONSES);
- request.getSession().removeAttribute(MAP_MAIN_REPORT);
- request.getSession().removeAttribute(MAP_STATS);
- request.getSession().removeAttribute(REPORT_TITLE_MONITOR);
- request.getSession().removeAttribute(MONITOR_USER_ID);
- request.getSession().removeAttribute(MONITORING_REPORT);
- request.getSession().removeAttribute(MONITORING_ERROR);
- request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS);
- request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS);
- request.getSession().removeAttribute(MONITORED_CONTENT_ID);
- request.getSession().removeAttribute(EDITACTIVITY_EDITMODE);
- request.getSession().removeAttribute(FORM_INDEX);
- request.getSession().removeAttribute(SELECTION_CASE);
- request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO);
- request.getSession().removeAttribute(QUESTION_LISTING_MODE);
- request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL);
- request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED);
- request.getSession().removeAttribute(PREVIEW_ONLY);
- request.getSession().removeAttribute(TIMEZONE);
- request.getSession().removeAttribute(MODE);
- request.getSession().removeAttribute(LEARNING_MODE);
- request.getSession().removeAttribute(EXPORT_USER_ID);
- request.getSession().removeAttribute(MAP_INCORRECT_FEEDBACK);
- request.getSession().removeAttribute(MAP_CORRECT_FEEDBACK);
- request.getSession().removeAttribute(MAP_INCORRECT_FEEDBACK_LEARNER);
- request.getSession().removeAttribute(MAP_CORRECT_FEEDBACK_LEARNER);
- request.getSession().removeAttribute(ACTIVITY_TITLE);
- request.getSession().removeAttribute(ACTIVITY_INSTRUCTIONS);
- request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID);
}
-
-
- /**
- *
- * determines the struts level location to return
- *
- * @param sourceMcStarter
- * @param requestedModule
- * @return
- */
- public static String getDestination(String sourceMcStarter, String requestedModule)
- {
-
- if (requestedModule.equals(DEFINE_LATER))
- {
- //request is from define Later url. return to LOAD_VIEW_ONLY
- return LOAD_VIEW_ONLY;
- }
- else if (requestedModule.equals(AUTHORING))
- {
- //request is from authoring url. return to LOAD_QUESTIONS
- return LOAD_QUESTIONS;
- }
- else
- {
- //request is from an unknown source. return null
- return null;
- }
+
+ /**
+ *
+ * @param request
+ * @param defaultMcContent
+ * @param mcGeneralAuthoringDTO
+ */
+ public static void populateAuthoringDTO(HttpServletRequest request, McContent defaultMcContent,
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO) {
+ mcGeneralAuthoringDTO.setActivityTitle(defaultMcContent.getTitle());
+ mcGeneralAuthoringDTO.setActivityInstructions(defaultMcContent.getInstructions());
+
+ mcGeneralAuthoringDTO.setOnlineInstructions(defaultMcContent.getOnlineInstructions());
+ mcGeneralAuthoringDTO.setOfflineInstructions(defaultMcContent.getOfflineInstructions());
+ }
+
+ /**
+ * @param request
+ * @param value
+ * @param toolContentID
+ */
+ public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID,
+ IMcService mcService) {
+
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ if (mcContent != null) {
+ mcContent.setDefineLater(value);
+ mcService.updateMc(mcContent);
}
+ }
-
- /**
- *
- * @param request
- * @param defaultMcContent
- * @param mcGeneralAuthoringDTO
- */
- public static void populateAuthoringDTO(HttpServletRequest request, McContent defaultMcContent,
- McGeneralAuthoringDTO mcGeneralAuthoringDTO)
- {
- mcGeneralAuthoringDTO.setActivityTitle(defaultMcContent.getTitle());
- mcGeneralAuthoringDTO.setActivityInstructions(defaultMcContent.getInstructions());
-
- mcGeneralAuthoringDTO.setOnlineInstructions(defaultMcContent.getOnlineInstructions());
- mcGeneralAuthoringDTO.setOfflineInstructions(defaultMcContent.getOfflineInstructions());
+ /**
+ *
+ * @param request
+ * @param mcService
+ * @param mcAuthoringForm
+ * @param mcGeneralAuthoringDTO
+ * @param strToolContentID
+ * @param defaultContentIdStr
+ * @param activeModule
+ * @param sessionMap
+ * @param httpSessionID
+ */
+ public static void setFormProperties(HttpServletRequest request, IMcService mcService,
+ McAuthoringForm mcAuthoringForm, McGeneralAuthoringDTO mcGeneralAuthoringDTO, String strToolContentID,
+ String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) {
+
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+
+ mcAuthoringForm.setToolContentID(strToolContentID);
+
+ if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) {
+ mcAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
}
-
- /**
- * @param request
- * @param value
- * @param toolContentID
- */
- public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IMcService mcService)
- {
-
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- if (mcContent != null)
- {
- mcContent.setDefineLater(value);
- mcService.updateMc(mcContent);
- }
- }
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
-
- /**
- *
- * @param request
- * @param mcService
- * @param mcAuthoringForm
- * @param mcGeneralAuthoringDTO
- * @param strToolContentID
- * @param defaultContentIdStr
- * @param activeModule
- * @param sessionMap
- * @param httpSessionID
- */
- public static void setFormProperties(HttpServletRequest request, IMcService mcService,
- McAuthoringForm mcAuthoringForm, McGeneralAuthoringDTO mcGeneralAuthoringDTO, String strToolContentID, String defaultContentIdStr,
- String activeModule, SessionMap sessionMap, String httpSessionID)
- {
+ String sln = request.getParameter("sln");
+ mcAuthoringForm.setSln(sln);
+ mcGeneralAuthoringDTO.setSln(sln);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
-
- mcAuthoringForm.setToolContentID(strToolContentID);
-
- if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0))
- {
- mcAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
- mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
- }
-
-
- mcAuthoringForm.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
-
- String sln=request.getParameter("sln");
- mcAuthoringForm.setSln(sln);
- mcGeneralAuthoringDTO.setSln(sln);
-
- String questionsSequenced=request.getParameter("questionsSequenced");
- mcAuthoringForm.setQuestionsSequenced(questionsSequenced);
- mcGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced);
+ String questionsSequenced = request.getParameter("questionsSequenced");
+ mcAuthoringForm.setQuestionsSequenced(questionsSequenced);
+ mcGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced);
- String randomize=request.getParameter("randomize");
- mcAuthoringForm.setRandomize(randomize);
- mcGeneralAuthoringDTO.setRandomize(randomize);
+ String randomize = request.getParameter("randomize");
+ mcAuthoringForm.setRandomize(randomize);
+ mcGeneralAuthoringDTO.setRandomize(randomize);
-
- String showMarks=request.getParameter("showMarks");
- mcAuthoringForm.setShowMarks(showMarks);
- mcGeneralAuthoringDTO.setShowMarks(showMarks);
-
-
- String retries=request.getParameter("retries");
- mcAuthoringForm.setRetries(retries);
- mcGeneralAuthoringDTO.setRetries(retries);
-
-
- String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS);
- mcAuthoringForm.setOfflineInstructions(offlineInstructions);
- mcGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+ String showMarks = request.getParameter("showMarks");
+ mcAuthoringForm.setShowMarks(showMarks);
+ mcGeneralAuthoringDTO.setShowMarks(showMarks);
- String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS);
- mcAuthoringForm.setOnlineInstructions(onlineInstructions);
- mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+ String retries = request.getParameter("retries");
+ mcAuthoringForm.setRetries(retries);
+ mcGeneralAuthoringDTO.setRetries(retries);
+ String offlineInstructions = request.getParameter(OFFLINE_INSTRUCTIONS);
+ mcAuthoringForm.setOfflineInstructions(offlineInstructions);
+ mcGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
- String reflect=request.getParameter(REFLECT);
- mcAuthoringForm.setReflect(reflect);
- mcGeneralAuthoringDTO.setReflect(reflect);
-
+ String onlineInstructions = request.getParameter(ONLINE_INSTRUCTIONS);
+ mcAuthoringForm.setOnlineInstructions(onlineInstructions);
+ mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
- String reflectionSubject=request.getParameter(REFLECTION_SUBJECT);
- mcAuthoringForm.setReflectionSubject(reflectionSubject);
- mcGeneralAuthoringDTO.setReflectionSubject(reflectionSubject);
-
-
- String passmark= request.getParameter("passmark");
- mcGeneralAuthoringDTO.setPassMarkValue(passmark);
+ String reflect = request.getParameter(REFLECT);
+ mcAuthoringForm.setReflect(reflect);
+ mcGeneralAuthoringDTO.setReflect(reflect);
+
+ String reflectionSubject = request.getParameter(REFLECTION_SUBJECT);
+ mcAuthoringForm.setReflectionSubject(reflectionSubject);
+ mcGeneralAuthoringDTO.setReflectionSubject(reflectionSubject);
+
+ String passmark = request.getParameter("passmark");
+ mcGeneralAuthoringDTO.setPassMarkValue(passmark);
}
-
- /** If this file exists in attachments map, move it to the deleted attachments map.
- * Returns the updated deletedAttachments map, creating a new one if needed. If uuid supplied
- * then tries to match on that, otherwise uses filename and isOnline. */
- public static List moveToDelete(String uuid, List attachmentsList, List deletedAttachmentsList ) {
+ /**
+ * If this file exists in attachments map, move it to the deleted attachments map. Returns the updated
+ * deletedAttachments map, creating a new one if needed. If uuid supplied then tries to match on that, otherwise
+ * uses filename and isOnline.
+ */
+ public static List moveToDelete(String uuid, List attachmentsList, List deletedAttachmentsList) {
- List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList();
-
- if ( attachmentsList != null ) {
- Iterator iter = attachmentsList.iterator();
- McUploadedFile attachment = null;
- while ( iter.hasNext() && attachment == null ) {
- McUploadedFile value = (McUploadedFile) iter.next();
- if ( uuid.equals(value.getUuid()) ) {
- attachment = value;
- }
+ List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList();
- }
- if ( attachment != null ) {
- deletedList.add(attachment);
- attachmentsList.remove(attachment);
- }
- }
-
- return deletedList;
+ if (attachmentsList != null) {
+ Iterator iter = attachmentsList.iterator();
+ McUploadedFile attachment = null;
+ while (iter.hasNext() && attachment == null) {
+ McUploadedFile value = (McUploadedFile) iter.next();
+ if (uuid.equals(value.getUuid())) {
+ attachment = value;
+ }
+
+ }
+ if (attachment != null) {
+ deletedList.add(attachment);
+ attachmentsList.remove(attachment);
+ }
+ }
+
+ return deletedList;
}
-
-
- /** 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();
- McUploadedFile attachment = null;
- while ( iter.hasNext() && attachment == null ) {
- McUploadedFile value = (McUploadedFile) iter.next();
- if ( filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) {
- attachment = value;
- }
+ /**
+ * 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) {
- }
- if ( attachment != null ) {
- deletedList.add(attachment);
- attachmentsList.remove(attachment);
- }
- }
-
- return deletedList;
+ List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList();
+
+ if (attachmentsList != null) {
+ Iterator iter = attachmentsList.iterator();
+ McUploadedFile attachment = null;
+ while (iter.hasNext() && attachment == null) {
+ McUploadedFile value = (McUploadedFile) iter.next();
+ if (filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) {
+ attachment = value;
+ }
+
+ }
+ if (attachment != null) {
+ deletedList.add(attachment);
+ attachmentsList.remove(attachment);
+ }
+ }
+
+ return deletedList;
}
-
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java,v
diff -u -r1.5 -r1.6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java 17 Sep 2006 06:23:44 -0000 1.5
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java 8 May 2013 13:18:26 -0000 1.6
@@ -22,19 +22,17 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc;
-
/**
- * 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.
+ * 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_lamc/src/java/org/lamsfoundation/lams/tool/mc/ReflectionDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/ReflectionDTO.java,v
diff -u -r1.2 -r1.3
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/ReflectionDTO.java 17 Sep 2006 06:23:44 -0000 1.2
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/ReflectionDTO.java 8 May 2013 13:18:25 -0000 1.3
@@ -22,110 +22,113 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc;
-
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_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java,v
diff -u -r1.11 -r1.12
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java 2 Oct 2006 02:06:35 -0000 1.11
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcContentDAO.java 8 May 2013 13:18:26 -0000 1.12
@@ -29,90 +29,112 @@
/**
* @author Ozgur Demirtas
- * Interface for the McContent DAO, defines methods needed to access/modify mc content
+ *
+ * Interface for the McContent DAO, defines methods needed to access/modify mc content
+ *
*
*/
public interface IMcContentDAO {
/**
- * Return the persistent instance of a McContent
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid an identifier for the McContent instance.
- * @return the persistent instance of a McContent or null if not found
- */
- public McContent getMcContentByUID(Long uid);
-
- /**
- * Return the persistent instance of a McContent
- * with the given tool content id mcContentId
,
- * returns null if not found.
- *
- * @param mcContentId The tool content id
- * @return the persistent instance of a McContent or null if not found.
- */
- public McContent findMcContentById(Long mcContentId);
-
- /**
- * Returns the persistent instance of McContent
- * with the given tool session id mcSessionId
, returns null if not found.
+ *
+ * Return the persistent instance of a McContent with the given identifier uid
, returns null if not
+ * found.
+ *
*
- * @param mcSessionId The tool session id
+ * @param uid
+ * an identifier for the McContent instance.
+ * @return the persistent instance of a McContent or null if not found
+ */
+ public McContent getMcContentByUID(Long uid);
+
+ /**
+ *
+ * Return the persistent instance of a McContent with the given tool content id mcContentId
, returns
+ * null if not found.
+ *
+ *
+ * @param mcContentId
+ * The tool content id
+ * @return the persistent instance of a McContent or null if not found.
+ */
+ public McContent findMcContentById(Long mcContentId);
+
+ /**
+ *
+ * Returns the persistent instance of McContent with the given tool session id mcSessionId
, returns
+ * null if not found.
+ *
+ * @param mcSessionId
+ * The tool session id
* @return a persistent instance of McContent or null if not found.
*/
- public McContent getMcContentBySession(Long mcSessionId);
-
- /**
- *
Persist the given persistent instance of McContent.
- *
- * @param mcContent The instance of McContent to persist.
- */
+ public McContent getMcContentBySession(Long mcSessionId);
+
+ /**
+ *
+ * Persist the given persistent instance of McContent.
+ *
+ *
+ * @param mcContent
+ * The instance of McContent to persist.
+ */
public void saveMcContent(McContent mcContent);
-
+
/**
- * Update the given persistent instance of McContent.
+ *
+ * Update the given persistent instance of McContent.
+ *
*
- * @param mcContent The instance of McContent to persist.
+ * @param mcContent
+ * The instance of McContent to persist.
*/
public void updateMcContent(McContent mcContent);
/**
- * Delete the given instance of McContent
+ *
+ * Delete the given instance of McContent
+ *
*
- * @param mcContent The instance of McContent to delete.
+ * @param mcContent
+ * The instance of McContent to delete.
*/
public void removeMc(McContent mcContent);
-
-
+
/**
- * Delete the given instance of McContent with the
- * given tool content id mcContentId
+ *
+ * Delete the given instance of McContent with the given tool content id mcContentId
*
- * @param mcContentId The tool content Id.
+ * @param mcContentId
+ * The tool content Id.
*/
public void removeMcById(Long mcContentId);
-
-
+
/**
- *
Deletes all instances of McSession that are associated
- * with the given instance of McContent
+ *
+ * Deletes all instances of McSession that are associated with the given instance of McContent
+ *
*
- * @param mcContent The instance of McContent in which corresponding instances of McSession should be deleted.
+ * @param mcContent
+ * The instance of McContent in which corresponding instances of McSession should be deleted.
*/
public void removeMcSessions(McContent mcContent);
-
+
/**
- * Creates a persistent instance of McSession which is associated
- * with the McContent with tool content id mcContentId
+ *
+ * Creates a persistent instance of McSession which is associated with the McContent with tool content id
+ * mcContentId
*
*
- * @param mcContentId The tool content id
- * @param mcSession The instance of McSession to add
+ * @param mcContentId
+ * The tool content id
+ * @param mcSession
+ * The instance of McSession to add
*/
public void addMcSession(Long mcContentId, McSession mcSession);
-
+
public void saveOrUpdateMc(McContent mc);
-
+
public List findAll(Class objClass);
-
+
public void flush();
- }
\ No newline at end of file
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java,v
diff -u -r1.20 -r1.21
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java 15 Aug 2007 03:54:50 -0000 1.20
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcOptionsContentDAO.java 8 May 2013 13:18:26 -0000 1.21
@@ -28,88 +28,110 @@
/**
* @author Ozgur Demirtas
- * Interface for the McOptionsContent DAO, defines methods needed to access/modify mc options content
+ *
+ * Interface for the McOptionsContent DAO, defines methods needed to access/modify mc options content
+ *
*
*/
-public interface IMcOptionsContentDAO
-{
- /**
- * * Return the persistent instance of a McOptsContent
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid
- * @return McOptsContent
- */
- public McOptsContent getMcOptionsContentByUID(Long uid);
+public interface IMcOptionsContentDAO {
+ /**
+ * *
+ *
+ * Return the persistent instance of a McOptsContent with the given identifier uid
, returns null if not
+ * found.
+ *
+ *
+ * @param uid
+ * @return McOptsContent
+ */
+ public McOptsContent getMcOptionsContentByUID(Long uid);
- public List findMcOptionUidsByQueId(Long mcQueContentId);
-
- /**
- * Return a list of a McOptsContents
- * with the given identifier mcQueContentId
, returns null if not found.
+ public List findMcOptionUidsByQueId(Long mcQueContentId);
- * @param mcQueContentId
- * @return List
- */
- public List findMcOptionsContentByQueId(Long mcQueContentId);
-
- /**
- * Return the persistent instance of a McOptsContent
- * with the given identifiers option
, mcQueContentUid
returns null if not found.
- *
- * @param option
- * @param mcQueContentUid
- * @return McOptsContent
- */
- public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid);
-
- /**
- * Return a list of a persisted McOptsContents
- * with the given identifier mcQueContentId
, returns null if not found.
- *
- * @param mcQueContentId
- * @return List
- */
- public List getPersistedSelectedOptions(Long mcQueContentId);
-
- public List findMcOptionCorrectByQueId(Long mcQueContentId);
-
- public List populateCandidateAnswersDTO(Long mcQueContentId);
-
- public List getCorrectOption(Long mcQueContentId);
-
- /**
- * saves McOptsContent
- * @param mcOptionsContent
- */
- public void saveMcOptionsContent(McOptsContent mcOptionsContent);
-
- /**
- * updates McOptsContent
- * @param mcOptionsContent
- */
- public void updateMcOptionsContent(McOptsContent mcOptionsContent);
+ /**
+ *
+ * Return a list of a McOptsContents with the given identifier mcQueContentId
, returns null if not
+ * found.
+ *
+ *
+ * @param mcQueContentId
+ * @return List
+ */
+ public List findMcOptionsContentByQueId(Long mcQueContentId);
- /**
- * removes McOptsContent
- * @param mcOptionsContent
- */
- public void removeMcOptionsContentByUID(Long uid);
+ /**
+ *
+ * Return the persistent instance of a McOptsContent with the given identifiers option
,
+ * mcQueContentUid
returns null if not found.
+ *
+ *
+ * @param option
+ * @param mcQueContentUid
+ * @return McOptsContent
+ */
+ public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid);
- /**
- * removes McOptsContent
- * @param mcOptionsContent
- */
- public void removeMcOptionsContentByQueId(Long mcQueContentId);
+ /**
+ *
+ * Return a list of a persisted McOptsContents with the given identifier mcQueContentId
, returns null
+ * if not found.
+ *
+ *
+ * @param mcQueContentId
+ * @return List
+ */
+ public List getPersistedSelectedOptions(Long mcQueContentId);
- /**
- * removes McOptsContent
- * @param mcOptionsContent
- */
- public void removeMcOptionsContent(McOptsContent mcOptsContent);
-
- public List findMcOptionNamesByQueId(Long mcQueContentId);
-}
+ public List findMcOptionCorrectByQueId(Long mcQueContentId);
+ public List populateCandidateAnswersDTO(Long mcQueContentId);
+ public List getCorrectOption(Long mcQueContentId);
+ /**
+ *
+ * saves McOptsContent
+ *
+ *
+ * @param mcOptionsContent
+ */
+ public void saveMcOptionsContent(McOptsContent mcOptionsContent);
+
+ /**
+ *
+ * updates McOptsContent
+ *
+ *
+ * @param mcOptionsContent
+ */
+ public void updateMcOptionsContent(McOptsContent mcOptionsContent);
+
+ /**
+ *
+ * removes McOptsContent
+ *
+ *
+ * @param mcOptionsContent
+ */
+ public void removeMcOptionsContentByUID(Long uid);
+
+ /**
+ *
+ * removes McOptsContent
+ *
+ *
+ * @param mcOptionsContent
+ */
+ public void removeMcOptionsContentByQueId(Long mcQueContentId);
+
+ /**
+ *
+ * removes McOptsContent
+ *
+ *
+ * @param mcOptionsContent
+ */
+ public void removeMcOptionsContent(McOptsContent mcOptsContent);
+
+ public List findMcOptionNamesByQueId(Long mcQueContentId);
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java,v
diff -u -r1.21 -r1.22
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 2 Oct 2006 02:06:35 -0000 1.21
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java 8 May 2013 13:18:26 -0000 1.22
@@ -26,159 +26,196 @@
import org.lamsfoundation.lams.tool.mc.pojos.McQueContent;
-
/**
*
* @author Ozgur Demirtas
- * Interface for the McQueContent DAO, defines methods needed to access/modify mc question content
- *
+ *
+ * Interface for the McQueContent DAO, defines methods needed to access/modify mc question content
+ *
+ *
*/
-public interface IMcQueContentDAO
-{
- /**
- * * Return the persistent instance of a McQueContent
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid
- * @return McQueContent
- */
- public McQueContent getMcQueContentByUID(Long uid);
-
- /**
- * * Return the persistent instance of a McQueContent
- * with the given identifier mcContentId
, returns null if not found.
- *
- * @param mcContentId
- * @return McQueContent
- */
- public McQueContent getToolDefaultQuestionContent(final long mcContentId);
-
-
-
- /**
- * * Return the persistent instance of a McQueContent
- * with the given identifier question
and mcContentUid
, returns null if not found.
- *
- * @param question
- * @param mcContentUid
- * @return McQueContent
- */
- public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid);
-
- /**
- * * Return the persistent instance of a McQueContent
- * with the given identifier displayOrder
and mcContentUid
, returns null if not found.
- *
- * @param displayOrder
- * @param mcContentUid
- * @return McQueContent
- */
- public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid);
-
- /**
- * * Return a list of McQueContent
- * with the given identifier question
and mcContentUid
, returns null if not found.
- *
- * @param mcContentUid
- * @return List
- */
- public List getAllQuestionEntries(final long mcContentId);
-
- /**
- * * Return a list of McQueContent
- * with the given identifier question
and mcContentUid
, returns null if not found.
- *
- * @param mcContentUid
- * @return List
- */
- public List refreshQuestionContent(final Long mcContentId);
+public interface IMcQueContentDAO {
+ /**
+ * *
+ *
+ * Return the persistent instance of a McQueContent with the given identifier uid
, returns null if not
+ * found.
+ *
+ *
+ * @param uid
+ * @return McQueContent
+ */
+ public McQueContent getMcQueContentByUID(Long uid);
- /**
- * * removes McQueContent
- * with the given identifier question
and mcContentUid
, returns null if not found.
- *
- * @param mcContentUid
- */
- public void cleanAllQuestions(final Long mcContentUid);
-
- /**
- * * removes McQueContent
- * with the given identifier mcContentUid
- *
- * @param mcContentUid
- */
- public void cleanAllQuestionsSimple(final Long mcContentUid);
-
- /**
- * * resets McQueContent
- * with the given identifier mcContentUid
- *
- * @param mcContentUid
- */
- public void resetAllQuestions(final Long mcContentUid);
+ /**
+ * *
+ *
+ * Return the persistent instance of a McQueContent with the given identifier mcContentId
, returns null
+ * if not found.
+ *
+ *
+ * @param mcContentId
+ * @return McQueContent
+ */
+ public McQueContent getToolDefaultQuestionContent(final long mcContentId);
- /**
- * * removes McQueContent
- * with the given identifier mcContentUid
- *
- * @param mcContentUid
- */
- public void removeQuestionContentByMcUid(final Long mcContentUid);
-
- /**
- * * saves McQueContent
- * with the given identifier mcQueContent
- *
- * @param mcQueContent
- */
- public void saveMcQueContent(McQueContent mcQueContent);
-
- /**
- * * updates McQueContent
- * with the given identifier mcQueContent
- *
- * @param mcQueContent
- */
- public void updateMcQueContent(McQueContent mcQueContent);
-
- /**
- * * saves McQueContent
- * with the given identifier mcQueContent
- *
- * @param mcQueContent
- */
- public void saveOrUpdateMcQueContent(McQueContent mcQueContent);
-
- /**
- * * removes McQueContent
- * with the given identifier uid
- *
- * @param uid
- */
- public void removeMcQueContentByUID(Long uid);
+ /**
+ * *
+ *
+ * Return the persistent instance of a McQueContent with the given identifier question
and
+ * mcContentUid
, returns null if not found.
+ *
+ *
+ * @param question
+ * @param mcContentUid
+ * @return McQueContent
+ */
+ public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid);
- /**
- * * removes McQueContent
- * with the given identifier mcQueContent
- *
- * @param mcQueContent
- * @return
- */
- public void removeMcQueContent(McQueContent mcQueContent);
-
- /**
- * * used to get the next available display order
- * with the given identifier mcContentId
- *
- * @param mcQueContent
- * @return
- */
- public List getNextAvailableDisplayOrder(final long mcContentId);
-
- public McQueContent findMcQuestionContentByUid(Long uid);
-
- public List getAllQuestionEntriesSorted(final long qaContentId);
-
- public List getMcQueContentsByContentId(long mcContentId);
-
+ /**
+ * *
+ *
+ * Return the persistent instance of a McQueContent with the given identifier displayOrder
and
+ * mcContentUid
, returns null if not found.
+ *
+ *
+ * @param displayOrder
+ * @param mcContentUid
+ * @return McQueContent
+ */
+ public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid);
+
+ /**
+ * *
+ *
+ * Return a list of McQueContent with the given identifier question
and mcContentUid
,
+ * returns null if not found.
+ *
+ *
+ * @param mcContentUid
+ * @return List
+ */
+ public List getAllQuestionEntries(final long mcContentId);
+
+ /**
+ * *
+ *
+ * Return a list of McQueContent with the given identifier question
and mcContentUid
,
+ * returns null if not found.
+ *
+ *
+ * @param mcContentUid
+ * @return List
+ */
+ public List refreshQuestionContent(final Long mcContentId);
+
+ /**
+ * *
+ *
+ * removes McQueContent with the given identifier question
and mcContentUid
, returns null
+ * if not found.
+ *
+ *
+ * @param mcContentUid
+ */
+ public void cleanAllQuestions(final Long mcContentUid);
+
+ /**
+ * *
+ *
+ * removes McQueContent with the given identifier mcContentUid
+ *
+ *
+ * @param mcContentUid
+ */
+ public void cleanAllQuestionsSimple(final Long mcContentUid);
+
+ /**
+ * *
+ *
+ * resets McQueContent with the given identifier mcContentUid
+ *
+ *
+ * @param mcContentUid
+ */
+ public void resetAllQuestions(final Long mcContentUid);
+
+ /**
+ * *
+ *
+ * removes McQueContent with the given identifier mcContentUid
+ *
+ *
+ * @param mcContentUid
+ */
+ public void removeQuestionContentByMcUid(final Long mcContentUid);
+
+ /**
+ * *
+ *
+ * saves McQueContent with the given identifier mcQueContent
+ *
+ *
+ * @param mcQueContent
+ */
+ public void saveMcQueContent(McQueContent mcQueContent);
+
+ /**
+ * *
+ *
+ * updates McQueContent with the given identifier mcQueContent
+ *
+ *
+ * @param mcQueContent
+ */
+ public void updateMcQueContent(McQueContent mcQueContent);
+
+ /**
+ * *
+ *
+ * saves McQueContent with the given identifier mcQueContent
+ *
+ *
+ * @param mcQueContent
+ */
+ public void saveOrUpdateMcQueContent(McQueContent mcQueContent);
+
+ /**
+ * *
+ *
+ * removes McQueContent with the given identifier uid
+ *
+ *
+ * @param uid
+ */
+ public void removeMcQueContentByUID(Long uid);
+
+ /**
+ * *
+ *
+ * removes McQueContent with the given identifier mcQueContent
+ *
+ *
+ * @param mcQueContent
+ * @return
+ */
+ public void removeMcQueContent(McQueContent mcQueContent);
+
+ /**
+ * *
+ *
+ * used to get the next available display order with the given identifier mcContentId
+ *
+ *
+ * @param mcQueContent
+ * @return
+ */
+ public List getNextAvailableDisplayOrder(final long mcContentId);
+
+ public McQueContent findMcQuestionContentByUid(Long uid);
+
+ public List getAllQuestionEntriesSorted(final long qaContentId);
+
+ public List getMcQueContentsByContentId(long mcContentId);
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java,v
diff -u -r1.12 -r1.13
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java 17 Aug 2007 03:32:06 -0000 1.12
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java 8 May 2013 13:18:26 -0000 1.13
@@ -22,71 +22,76 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.dao;
-import java.util.List;
-
-import org.lamsfoundation.lams.tool.mc.pojos.McContent;
-import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
import org.lamsfoundation.lams.tool.mc.pojos.McSession;
-
/**
* @author Ozgur Demirtas
- * Interface for the McSession DAO, defines methods needed to access/modify mc session
+ *
+ * Interface for the McSession DAO, defines methods needed to access/modify mc session
+ *
*
*/
public interface IMcSessionDAO {
-
- /**
- * Return the persistent instance of a McSession
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid an identifier for the McSession object.
- * @return the persistent instance of a McSession or null if not found
- */
-
+
+ /**
+ *
+ * Return the persistent instance of a McSession with the given identifier uid
, returns null if not
+ * found.
+ *
+ *
+ * @param uid
+ * an identifier for the McSession object.
+ * @return the persistent instance of a McSession or null if not found
+ */
+
public McSession getMcSessionByUID(Long uid);
-
+
/**
- * Return the persistent instance of a McSession
- * with the given tool session id mcSessionId
,
- * returns null if not found.
- *
- * @param mcSessionId The tool session id
- * @return the persistent instance of a McSession or null if not found.
- */
+ *
+ * Return the persistent instance of a McSession with the given tool session id mcSessionId
, returns
+ * null if not found.
+ *
+ *
+ * @param mcSessionId
+ * The tool session id
+ * @return the persistent instance of a McSession or null if not found.
+ */
public McSession findMcSessionById(Long mcSessionId);
-
-
-
+
/**
- * Persist the given persistent instance of McSession.
- *
- * @param mcSession The instance of McSession to persist.
- */
+ *
+ * Persist the given persistent instance of McSession.
+ *
+ *
+ * @param mcSession
+ * The instance of McSession to persist.
+ */
public void saveMcSession(McSession mcSession);
-
+
/**
- * Update the given persistent instance of McSession.
+ *
+ * Update the given persistent instance of McSession.
+ *
*
- * @param mcContent The instance of McSession to persist.
+ * @param mcContent
+ * The instance of McSession to persist.
*/
public void updateMcSession(McSession mcSession);
/**
* Delete the given instance of McSession
*/
public void removeMcSession(McSession mcSession);
-
-
+
/**
- * Returns the persistent instance of McSession
- * associated with the given mc user, with user id userId
,
+ *
+ * Returns the persistent instance of McSession associated with the given mc user, with user id userId
,
* returns null if not found.
*
- * @param userId The mc user id
+ * @param userId
+ * The mc user id
* @return a persistent instance of McSessions or null if not found.
- */
+ */
public McSession getMcSessionByUser(Long userId);
-
}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/Attic/IMcUploadedFileDAO.java,v
diff -u -r1.14 -r1.15
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java 17 Aug 2007 03:32:06 -0000 1.14
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java 8 May 2013 13:18:26 -0000 1.15
@@ -32,25 +32,24 @@
/**
*
* @author Ozgur Demirtas
- *
+ *
*/
-public interface IMcUploadedFileDAO
-{
- public McUploadedFile loadUploadedFileById(long submissionId);
+public interface IMcUploadedFileDAO {
+ public McUploadedFile loadUploadedFileById(long submissionId);
- public void updateUploadFile(McUploadedFile mcUploadedFile);
-
- public void saveUploadFile(McUploadedFile mcUploadedFile);
-
- public void createUploadFile(McUploadedFile mcUploadedFile);
-
- public void UpdateUploadFile(McUploadedFile mcUploadedFile);
+ public void updateUploadFile(McUploadedFile mcUploadedFile);
- public void removeUploadFile(Long submissionId);
-
- public void deleteUploadFile(McUploadedFile mcUploadedFile);
-
- public List retrieveMcUploadedFiles(McContent mc);
-
- public void flush();
+ public void saveUploadFile(McUploadedFile mcUploadedFile);
+
+ public void createUploadFile(McUploadedFile mcUploadedFile);
+
+ public void UpdateUploadFile(McUploadedFile mcUploadedFile);
+
+ public void removeUploadFile(Long submissionId);
+
+ public void deleteUploadFile(McUploadedFile mcUploadedFile);
+
+ public List retrieveMcUploadedFiles(McContent mc);
+
+ public void flush();
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java,v
diff -u -r1.15 -r1.16
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java 17 Aug 2007 03:32:06 -0000 1.15
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java 8 May 2013 13:18:26 -0000 1.16
@@ -22,55 +22,64 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.dao;
-import java.util.List;
-
-import org.lamsfoundation.lams.tool.mc.pojos.McContent;
import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
-import org.lamsfoundation.lams.tool.mc.pojos.McSession;
/**
* @author Ozgur Demirtas
- * Interface for the McUser DAO, defines methods needed to access/modify user data
+ *
+ * Interface for the McUser DAO, defines methods needed to access/modify user data
+ *
*/
public interface IMcUserDAO {
-
+
/**
- * Return the persistent instance of a McQueUsr
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid an identifier for the McQueUsr.
- * @return the persistent instance of a McQueUsr or null if not found
- */
+ *
+ * Return the persistent instance of a McQueUsr with the given identifier uid
, returns null if not
+ * found.
+ *
+ *
+ * @param uid
+ * an identifier for the McQueUsr.
+ * @return the persistent instance of a McQueUsr or null if not found
+ */
public McQueUsr getMcUserByUID(Long uid);
-
+
/**
- * Return the persistent instance of a McQueUsr
- * with the given user id userId
,
- * returns null if not found.
- *
- * @param userId The id of a McQueUsr
- * @return the persistent instance of a McQueUsr or null if not found.
- */
+ *
+ * Return the persistent instance of a McQueUsr with the given user id userId
, returns null if not
+ * found.
+ *
+ *
+ * @param userId
+ * The id of a McQueUsr
+ * @return the persistent instance of a McQueUsr or null if not found.
+ */
public McQueUsr findMcUserById(Long userId);
-
+
public McQueUsr getMcUserBySession(Long userId, Long sessionId);
-
+
public void saveMcUser(McQueUsr mcUser);
-
+
/**
- * Update the given persistent instance of McQueUsr.
+ *
+ * Update the given persistent instance of McQueUsr.
+ *
*
- * @param nbUser The instance of McQueUsr to persist.
+ * @param nbUser
+ * The instance of McQueUsr to persist.
*/
public void updateMcUser(McQueUsr mcUser);
-
+
/**
- * Delete the given instance of McQueUsr
+ *
+ * Delete the given instance of McQueUsr
+ *
*
- * @param nbUser The instance of McQueUsr to delete.
+ * @param nbUser
+ * The instance of McQueUsr to delete.
*/
public void removeMcUser(McQueUsr mcUser);
-
- /** Get the max, min and average mark (in that order) for a session */
+
+ /** Get the max, min and average mark (in that order) for a session */
public Integer[] getMarkStatisticsForSession(Long sessionUid);
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java,v
diff -u -r1.18 -r1.19
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java 15 Aug 2007 03:54:50 -0000 1.18
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUsrAttemptDAO.java 8 May 2013 13:18:26 -0000 1.19
@@ -24,106 +24,121 @@
import java.util.List;
-import org.lamsfoundation.lams.tool.mc.pojos.McContent;
-import org.lamsfoundation.lams.tool.mc.pojos.McSession;
import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt;
-
/**
*
- * @author Ozgur Demirtas
- * * Interface for the McUsrAttempt DAO, defines methods needed to access/modify user attempt data
- *
+ * @author Ozgur Demirtas *
+ *
+ * Interface for the McUsrAttempt DAO, defines methods needed to access/modify user attempt data
+ *
+ *
*/
-public interface IMcUsrAttemptDAO
-{
-
+public interface IMcUsrAttemptDAO {
+
/**
- * * Return the persistent instance of a McUsrAttempt
- * with the given identifier uid
, returns null if not found.
- *
- * @param uid
- * @return McQueContent
- */
- public McUsrAttempt getMcUserAttemptByUID(Long uid);
+ * *
+ *
+ * Return the persistent instance of a McUsrAttempt with the given identifier uid
, returns null if not
+ * found.
+ *
+ *
+ * @param uid
+ * @return McQueContent
+ */
+ public McUsrAttempt getMcUserAttemptByUID(Long uid);
- /**
- * * saves McUsrAttempt
- * with the given identifier mcUsrAttempt
- *
- * @param uid
- * @return
- */
- public void saveMcUsrAttempt(McUsrAttempt mcUsrAttempt);
-
- /**
- * * updates McUsrAttempt
- * with the given identifier mcUsrAttempt
- *
- * @param mcUsrAttempt
- * @return
- */
- public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt);
-
- /**
- * * removes McUsrAttempt
- * with the given identifier uid
- *
- * @param uid
- * @return
- */
- public void removeMcUsrAttemptByUID(Long uid);
+ /**
+ * *
+ *
+ * saves McUsrAttempt with the given identifier mcUsrAttempt
+ *
+ *
+ * @param uid
+ * @return
+ */
+ public void saveMcUsrAttempt(McUsrAttempt mcUsrAttempt);
- /**
- * * removes McUsrAttempt
- * with the given identifier mcUsrAttempt
- *
- * @param mcUsrAttempt
- * @return
- */
- public void removeMcUsrAttempt(McUsrAttempt mcUsrAttempt);
-
- /**
- * gets all the attempts (for all questions) for one user in one tool session
- *
- * @param queUsrId
- * @return
- */
- public List getUserAttemptsForSession(Long queUsrId);
+ /**
+ * *
+ *
+ * updates McUsrAttempt with the given identifier mcUsrAttempt
+ *
+ *
+ * @param mcUsrAttempt
+ * @return
+ */
+ public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt);
- /**
- * Get the most recent attempts (for all questions) for one user in one tool session
- * @param queUserUid
- * @return
- */
- public List getLatestAttemptsForAUser(Long queUserUid);
-
- /**
- * gets all the attempts for one questions for one user in one tool session queUsrId
,
- * ordered by the attempt id. If there is more than one option selected for a question, the attempts
- * are "batched".
- *
- * @param queUsrId
- * @return
- */
- public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(Long queUsrUid, Long mcQueContentId);
-
- /**
- * Get the highest attempt order for a user for a particular question
- */
- public List getLatestAttemptsForAUserForOneQuestionContent(Long queUsrUid, Long mcQueContentId);
+ /**
+ * *
+ *
+ * removes McUsrAttempt with the given identifier uid
+ *
+ *
+ * @param uid
+ * @return
+ */
+ public void removeMcUsrAttemptByUID(Long uid);
- /**
- * * returns a list of attempts
- * with the given identifiers queUsrId
and mcQueContentId
and attemptOrder
- *
- * @param queUsrId
- * @param mcQueContentId
- * @param attemptOrder
- * @return
- */
- public List getAttemptByAttemptOrder(final Long queUsrUid, final Long mcQueContentId, final Integer attemptOrder);
-
-}
+ /**
+ * *
+ *
+ * removes McUsrAttempt with the given identifier mcUsrAttempt
+ *
+ *
+ * @param mcUsrAttempt
+ * @return
+ */
+ public void removeMcUsrAttempt(McUsrAttempt mcUsrAttempt);
+ /**
+ *
+ * gets all the attempts (for all questions) for one user in one tool session
+ *
+ *
+ * @param queUsrId
+ * @return
+ */
+ public List getUserAttemptsForSession(Long queUsrId);
+ /**
+ * Get the most recent attempts (for all questions) for one user in one tool session
+ *
+ * @param queUserUid
+ * @return
+ */
+ public List getLatestAttemptsForAUser(Long queUserUid);
+
+ /**
+ *
+ * gets all the attempts for one questions for one user in one tool session queUsrId
, ordered by the
+ * attempt id. If there is more than one option selected for a question, the attempts are "batched".
+ *
+ *
+ * @param queUsrId
+ * @return
+ */
+ public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(Long queUsrUid,
+ Long mcQueContentId);
+
+ /**
+ * Get the highest attempt order for a user for a particular question
+ */
+ public List getLatestAttemptsForAUserForOneQuestionContent(Long queUsrUid, Long mcQueContentId);
+
+ /**
+ * *
+ *
+ * returns a list of attempts with the given identifiers queUsrId
and mcQueContentId
and
+ * attemptOrder
+ *
+ *
+ * @param queUsrId
+ * @param mcQueContentId
+ * @param attemptOrder
+ * @return
+ */
+ public List getAttemptByAttemptOrder(final Long queUsrUid, final Long mcQueContentId, final Integer attemptOrder);
+
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java,v
diff -u -r1.20 -r1.21
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java 8 May 2013 13:03:18 -0000 1.20
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McContentDAO.java 8 May 2013 13:18:26 -0000 1.21
@@ -24,7 +24,6 @@
import java.util.List;
-import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
@@ -37,116 +36,95 @@
/**
* @author Ozgur Demirtas
- * Hibernate implementation for database access to McContent for the mc tool.
+ *
+ * Hibernate implementation for database access to McContent for the mc tool.
+ *
*/
public class McContentDAO extends HibernateDaoSupport implements IMcContentDAO {
-
- private static final String FIND_MC_CONTENT = "from " + McContent.class.getName() + " as mc where content_id=?";
-
- private static final String LOAD_MC_BY_SESSION = "select mc from McContent mc left join fetch "
- + "mc.mcSessions session where session.mcSessionId=:sessionId";
- public McContent getMcContentByUID(Long uid)
- {
- return (McContent) this.getHibernateTemplate().get(McContent.class, uid);
- }
-
- public McContent findMcContentById(Long mcContentId)
- {
- String query = "from McContent as mc where mc.mcContentId = ?";
- HibernateTemplate templ = this.getHibernateTemplate();
+ private static final String FIND_MC_CONTENT = "from " + McContent.class.getName() + " as mc where content_id=?";
- List list = getSession().createQuery(FIND_MC_CONTENT)
- .setLong(0,mcContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McContent mc = (McContent) list.get(0);
- return mc;
- }
- return null;
- }
-
+ private static final String LOAD_MC_BY_SESSION = "select mc from McContent mc left join fetch "
+ + "mc.mcSessions session where session.mcSessionId=:sessionId";
- public McContent getMcContentBySession(final Long mcSessionId)
- {
- return (McContent) getHibernateTemplate().execute(new HibernateCallback()
- {
+ public McContent getMcContentByUID(Long uid) {
+ return (McContent) this.getHibernateTemplate().get(McContent.class, uid);
+ }
- public Object doInHibernate(Session session) throws HibernateException
- {
- return session.createQuery(LOAD_MC_BY_SESSION)
- .setLong("sessionId",
- mcSessionId.longValue())
- .uniqueResult();
- }
- });
+ public McContent findMcContentById(Long mcContentId) {
+ String query = "from McContent as mc where mc.mcContentId = ?";
+ HibernateTemplate templ = this.getHibernateTemplate();
+
+ List list = getSession().createQuery(FIND_MC_CONTENT).setLong(0, mcContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McContent mc = (McContent) list.get(0);
+ return mc;
}
-
-
- public void saveMcContent(McContent mcContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().saveOrUpdate(mcContent);
+ return null;
}
-
- public void updateMcContent(McContent mcContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcContent);
+
+ public McContent getMcContentBySession(final Long mcSessionId) {
+ return (McContent) getHibernateTemplate().execute(new HibernateCallback() {
+
+ public Object doInHibernate(Session session) throws HibernateException {
+ return session.createQuery(LOAD_MC_BY_SESSION).setLong("sessionId", mcSessionId.longValue())
+ .uniqueResult();
+ }
+ });
}
- public void saveOrUpdateMc(McContent mc)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().saveOrUpdate(mc);
+ public void saveMcContent(McContent mcContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().saveOrUpdate(mcContent);
}
-
- public void removeMcById(Long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcContentId != null) {
- List list = getSession().createQuery(FIND_MC_CONTENT)
- .setLong(0,mcContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McContent mc = (McContent) list.get(0);
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(mc);
- templ.flush();
- }
- }
+ public void updateMcContent(McContent mcContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcContent);
}
-
- public void removeMc(McContent mcContent)
- {
- this.getHibernateTemplate().delete(mcContent);
+
+ public void saveOrUpdateMc(McContent mc) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().saveOrUpdate(mc);
}
-
- public void removeMcSessions(McContent mcContent)
- {
- this.getHibernateTemplate().deleteAll(mcContent.getMcSessions());
+ public void removeMcById(Long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcContentId != null) {
+ List list = getSession().createQuery(FIND_MC_CONTENT).setLong(0, mcContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McContent mc = (McContent) list.get(0);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mc);
+ templ.flush();
+ }
+ }
}
-
- public void addMcSession(Long mcContentId, McSession mcSession)
- {
- McContent content = findMcContentById(mcContentId);
- mcSession.setMcContent(content);
- content.getMcSessions().add(mcSession);
- this.getHibernateTemplate().saveOrUpdate(mcSession);
- this.getHibernateTemplate().saveOrUpdate(content);
+
+ public void removeMc(McContent mcContent) {
+ this.getHibernateTemplate().delete(mcContent);
}
-
+
+ public void removeMcSessions(McContent mcContent) {
+ this.getHibernateTemplate().deleteAll(mcContent.getMcSessions());
+ }
+
+ public void addMcSession(Long mcContentId, McSession mcSession) {
+ McContent content = findMcContentById(mcContentId);
+ mcSession.setMcContent(content);
+ content.getMcSessions().add(mcSession);
+ this.getHibernateTemplate().saveOrUpdate(mcSession);
+ this.getHibernateTemplate().saveOrUpdate(content);
+ }
+
public List findAll(Class objClass) {
- String query="from obj in class " + objClass.getName();
- return this.getHibernateTemplate().find(query);
- }
-
- public void flush()
- {
- this.getHibernateTemplate().flush();
+ String query = "from obj in class " + objClass.getName();
+ return this.getHibernateTemplate().find(query);
}
+
+ public void flush() {
+ this.getHibernateTemplate().flush();
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java,v
diff -u -r1.23 -r1.24
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java 15 Aug 2007 03:54:50 -0000 1.23
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McOptionsContentDAO.java 8 May 2013 13:18:26 -0000 1.24
@@ -34,225 +34,184 @@
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
/**
* @author Ozgur Demirtas
- * Hibernate implementation for database access to McOptionsContent for the mc tool.
+ *
+ * Hibernate implementation for database access to McOptionsContent for the mc tool.
+ *
*/
public class McOptionsContentDAO extends HibernateDaoSupport implements IMcOptionsContentDAO {
- static Logger logger = Logger.getLogger(McOptionsContentDAO.class.getName());
-
- //private static final String FIND_MC_OPTIONS_CONTENT = "from " + McOptsContent.class.getName() + " as mco where mc_que_content_id=?";
- private static final String FIND_MC_OPTIONS_CONTENT = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid order by mcOptsContent.displayOrder";
- private static final String LOAD_OPTION_CONTENT_BY_OPTION_TEXT = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueOptionText=:option and mcOptsContent.mcQueContentId=:mcQueContentUid";
-
- private static final String LOAD_PERSISTED_SELECTED_OPTIONS = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid and mcOptsContent.correctOption = 1";
-
- private static final String LOAD_CORRECT_OPTION = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid and mcOptsContent.correctOption = 1";
-
-
- private static final String LOAD_MAX_UID = "from mcOptsContent in class McOptsContent";
-
- public McOptsContent getMcOptionsContentByUID(Long uid)
- {
- return (McOptsContent) this.getHibernateTemplate()
- .get(McOptsContent.class, uid);
+ static Logger logger = Logger.getLogger(McOptionsContentDAO.class.getName());
+
+ // private static final String FIND_MC_OPTIONS_CONTENT = "from " + McOptsContent.class.getName() +
+ // " as mco where mc_que_content_id=?";
+ private static final String FIND_MC_OPTIONS_CONTENT = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid order by mcOptsContent.displayOrder";
+ private static final String LOAD_OPTION_CONTENT_BY_OPTION_TEXT = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueOptionText=:option and mcOptsContent.mcQueContentId=:mcQueContentUid";
+
+ private static final String LOAD_PERSISTED_SELECTED_OPTIONS = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid and mcOptsContent.correctOption = 1";
+
+ private static final String LOAD_CORRECT_OPTION = "from mcOptsContent in class McOptsContent where mcOptsContent.mcQueContentId=:mcQueContentUid and mcOptsContent.correctOption = 1";
+
+ private static final String LOAD_MAX_UID = "from mcOptsContent in class McOptsContent";
+
+ public McOptsContent getMcOptionsContentByUID(Long uid) {
+ return (McOptsContent) this.getHibernateTemplate().get(McOptsContent.class, uid);
+ }
+
+ public List findMcOptionsContentByQueId(Long mcQueContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcQueContentId != null) {
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+ return list;
+ }
+ return null;
+ }
+
+ public List findMcOptionUidsByQueId(Long mcQueContentId) {
+
+ List listOptionUids = new LinkedList();
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcQueContentId != null) {
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) listIterator.next();
+ listOptionUids.add(mcOptsContent.getUid().toString());
}
-
-
- public List findMcOptionsContentByQueId(Long mcQueContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcQueContentId != null) {
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
- return list;
- }
- return null;
}
+ }
+ return listOptionUids;
+ }
-
- public List findMcOptionUidsByQueId(Long mcQueContentId)
- {
-
- List listOptionUids= new LinkedList();
-
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcQueContentId != null) {
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McOptsContent mcOptsContent=(McOptsContent)listIterator.next();
- listOptionUids.add(mcOptsContent.getUid().toString());
- }
- }
- }
- return listOptionUids;
+ public List findMcOptionNamesByQueId(Long mcQueContentId) {
+
+ List listOptionNames = new LinkedList();
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcQueContentId != null) {
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) listIterator.next();
+ listOptionNames.add(mcOptsContent.getMcQueOptionText());
+ }
}
-
-
- public List findMcOptionNamesByQueId(Long mcQueContentId)
- {
-
- List listOptionNames= new LinkedList();
-
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcQueContentId != null) {
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McOptsContent mcOptsContent=(McOptsContent)listIterator.next();
- listOptionNames.add(mcOptsContent.getMcQueOptionText());
- }
- }
- }
- return listOptionNames;
- }
-
-
- public List populateCandidateAnswersDTO(Long mcQueContentId)
- {
- List listCandidateAnswersData= new LinkedList();
-
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcQueContentId != null) {
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McOptsContent mcOptsContent=(McOptsContent)listIterator.next();
- McCandidateAnswersDTO mcCandidateAnswersDTO= new McCandidateAnswersDTO();
- mcCandidateAnswersDTO.setCandidateAnswer(mcOptsContent.getMcQueOptionText());
- mcCandidateAnswersDTO.setCorrect(new Boolean(mcOptsContent.isCorrectOption()).toString());
- listCandidateAnswersData.add(mcCandidateAnswersDTO);
- }
- }
- }
- return listCandidateAnswersData;
- }
+ }
+ return listOptionNames;
+ }
-
- public List findMcOptionCorrectByQueId(Long mcQueContentId)
- {
-
- List listOptionCorrect= new LinkedList();
-
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( mcQueContentId != null) {
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McOptsContent mcOptsContent=(McOptsContent)listIterator.next();
- listOptionCorrect.add(new Boolean(mcOptsContent.isCorrectOption()).toString());
- }
- }
- }
- return listOptionCorrect;
+ public List populateCandidateAnswersDTO(Long mcQueContentId) {
+ List listCandidateAnswersData = new LinkedList();
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcQueContentId != null) {
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) listIterator.next();
+ McCandidateAnswersDTO mcCandidateAnswersDTO = new McCandidateAnswersDTO();
+ mcCandidateAnswersDTO.setCandidateAnswer(mcOptsContent.getMcQueOptionText());
+ mcCandidateAnswersDTO.setCorrect(new Boolean(mcOptsContent.isCorrectOption()).toString());
+ listCandidateAnswersData.add(mcCandidateAnswersDTO);
+ }
}
+ }
+ return listCandidateAnswersData;
+ }
-
-
- public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_OPTION_CONTENT_BY_OPTION_TEXT)
- .setString("option", option)
- .setLong("mcQueContentUid", mcQueContentUid.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McOptsContent mcq = (McOptsContent) list.get(0);
- return mcq;
- }
- return null;
+ public List findMcOptionCorrectByQueId(Long mcQueContentId) {
+
+ List listOptionCorrect = new LinkedList();
+
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (mcQueContentId != null) {
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) listIterator.next();
+ listOptionCorrect.add(new Boolean(mcOptsContent.isCorrectOption()).toString());
+ }
}
-
-
- public List getPersistedSelectedOptions(Long mcQueContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_PERSISTED_SELECTED_OPTIONS)
- .setLong("mcQueContentUid", mcQueContentId.longValue())
- .list();
-
- return list;
- }
-
- public List getCorrectOption(Long mcQueContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_CORRECT_OPTION)
- .setLong("mcQueContentUid", mcQueContentId.longValue())
- .list();
-
- return list;
- }
-
- public void saveMcOptionsContent(McOptsContent mcOptsContent)
- {
- this.getHibernateTemplate().save(mcOptsContent);
- }
-
- public void updateMcOptionsContent(McOptsContent mcOptsContent)
- {
- this.getHibernateTemplate().update(mcOptsContent);
- }
-
-
- public void removeMcOptionsContentByUID(Long uid)
- {
- McOptsContent mco = (McOptsContent)getHibernateTemplate().get(McOptsContent.class, uid);
- this.getHibernateTemplate().delete(mco);
- }
-
-
- public void removeMcOptionsContentByQueId(Long mcQueContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
- .setLong("mcQueContentUid",mcQueContentId.longValue())
- .list();
+ }
+ return listOptionCorrect;
+ }
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McOptsContent mcOptsContent=(McOptsContent)listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(mcOptsContent);
- }
- }
+ public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_OPTION_CONTENT_BY_OPTION_TEXT).setString("option", option)
+ .setLong("mcQueContentUid", mcQueContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McOptsContent mcq = (McOptsContent) list.get(0);
+ return mcq;
+ }
+ return null;
+ }
+
+ public List getPersistedSelectedOptions(Long mcQueContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_PERSISTED_SELECTED_OPTIONS)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ return list;
+ }
+
+ public List getCorrectOption(Long mcQueContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_CORRECT_OPTION)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ return list;
+ }
+
+ public void saveMcOptionsContent(McOptsContent mcOptsContent) {
+ this.getHibernateTemplate().save(mcOptsContent);
+ }
+
+ public void updateMcOptionsContent(McOptsContent mcOptsContent) {
+ this.getHibernateTemplate().update(mcOptsContent);
+ }
+
+ public void removeMcOptionsContentByUID(Long uid) {
+ McOptsContent mco = (McOptsContent) getHibernateTemplate().get(McOptsContent.class, uid);
+ this.getHibernateTemplate().delete(mco);
+ }
+
+ public void removeMcOptionsContentByQueId(Long mcQueContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(FIND_MC_OPTIONS_CONTENT)
+ .setLong("mcQueContentUid", mcQueContentId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcOptsContent);
}
-
-
- public void removeMcOptionsContent(McOptsContent mcOptsContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcOptsContent);
- }
-
- public void flush()
- {
- this.getHibernateTemplate().flush();
- }
- }
\ No newline at end of file
+ }
+ }
+
+ public void removeMcOptionsContent(McOptsContent mcOptsContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcOptsContent);
+ }
+
+ public void flush() {
+ this.getHibernateTemplate().flush();
+ }
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java,v
diff -u -r1.31 -r1.32
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 8 May 2013 13:03:18 -0000 1.31
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java 8 May 2013 13:18:26 -0000 1.32
@@ -25,274 +25,219 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.mc.dao.IMcQueContentDAO;
import org.lamsfoundation.lams.tool.mc.pojos.McQueContent;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
/**
* @author Ozgur Demirtas
*
- * Hibernate implementation for database access to McQueContent for the mc tool.
+ *
+ * Hibernate implementation for database access to McQueContent for the mc tool.
+ *
*/
public class McQueContentDAO extends HibernateDaoSupport implements IMcQueContentDAO {
-
- private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
-
- private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID_SIMPLE = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
-
- private static final String FIND_QUESTION_CONTENT_BY_UID = "from mcQueContent in class McQueContent where mcQueContent.uid=:uid";
-
- private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
-
- private static final String REFRESH_QUESTION_CONTENT = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
-
- private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentUid";
-
- private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.displayOrder=:displayOrder and mcQueContent.mcContentId=:mcContentUid";
-
- private static final String GET_NEXT_AVAILABLE_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
-
- private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
-
-
- public McQueContent findMcQuestionContentByUid(Long uid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- if ( uid != null) {
- List list = getSession().createQuery(FIND_QUESTION_CONTENT_BY_UID)
- .setLong("uid",uid.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McQueContent mcq = (McQueContent) list.get(0);
- return mcq;
- }
- }
- return null;
- }
-
-
- public McQueContent getMcQueContentByUID(Long uid)
- {
- return (McQueContent) this.getHibernateTemplate()
- .get(McQueContent.class, uid);
- }
-
-
- public McQueContent getToolDefaultQuestionContent(final long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("mcContentId", mcContentId)
- .list();
-
- if(list != null && list.size() > 0){
- McQueContent mcq = (McQueContent) list.get(0);
- return mcq;
- }
- return null;
- }
-
-
- public List getAllQuestionEntries(final long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("mcContentId", mcContentId)
- .list();
+ private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
- return list;
- }
-
- public List refreshQuestionContent(final Long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(REFRESH_QUESTION_CONTENT)
- .setLong("mcContentId", mcContentId.longValue())
- .list();
-
- return list;
- }
-
-
- public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT)
- .setString("question", question)
- .setLong("mcContentUid", mcContentUid.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McQueContent mcq = (McQueContent) list.get(0);
- return mcq;
- }
- return null;
- }
-
-
- public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER)
- .setLong("displayOrder", displayOrder.longValue())
- .setLong("mcContentUid", mcContentUid.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McQueContent mcq = (McQueContent) list.get(0);
- return mcq;
- }
- return null;
- }
-
-
- public void removeQuestionContentByMcUid(final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("mcContentId", mcContentUid.longValue())
- .list();
+ private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID_SIMPLE = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McQueContent mcQueContent=(McQueContent)listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(mcQueContent);
- templ.flush();
- }
- }
- }
-
+ private static final String FIND_QUESTION_CONTENT_BY_UID = "from mcQueContent in class McQueContent where mcQueContent.uid=:uid";
- public void resetAllQuestions(final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("mcContentId", mcContentUid.longValue())
- .list();
+ private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McQueContent mcQueContent=(McQueContent)listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.update(mcQueContent);
- }
- }
- }
-
+ private static final String REFRESH_QUESTION_CONTENT = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
- public void cleanAllQuestions(final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(CLEAN_QUESTION_CONTENT_BY_CONTENT_ID)
- .setLong("mcContentId", mcContentUid.longValue())
- .list();
+ private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentUid";
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McQueContent mcQueContent=(McQueContent)listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(mcQueContent);
- }
- }
- }
+ private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.displayOrder=:displayOrder and mcQueContent.mcContentId=:mcContentUid";
-
- public void cleanAllQuestionsSimple(final Long mcContentUid)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(CLEAN_QUESTION_CONTENT_BY_CONTENT_ID_SIMPLE)
- .setLong("mcContentId", mcContentUid.longValue())
- .list();
+ private static final String GET_NEXT_AVAILABLE_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
- if(list != null && list.size() > 0){
- Iterator listIterator=list.iterator();
- while (listIterator.hasNext())
- {
- McQueContent mcQueContent=(McQueContent)listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(mcQueContent);
- }
- }
+ private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId order by mcQueContent.displayOrder";
+
+ public McQueContent findMcQuestionContentByUid(Long uid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ if (uid != null) {
+ List list = getSession().createQuery(FIND_QUESTION_CONTENT_BY_UID).setLong("uid", uid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McQueContent mcq = (McQueContent) list.get(0);
+ return mcq;
}
+ }
+ return null;
+ }
-
- public List getNextAvailableDisplayOrder(final long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(GET_NEXT_AVAILABLE_DISPLAY_ORDER)
- .setLong("mcContentId", mcContentId)
- .list();
-
- return list;
+ public McQueContent getMcQueContentByUID(Long uid) {
+ return (McQueContent) this.getHibernateTemplate().get(McQueContent.class, uid);
+ }
+
+ public McQueContent getToolDefaultQuestionContent(final long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID).setLong("mcContentId", mcContentId)
+ .list();
+
+ if (list != null && list.size() > 0) {
+ McQueContent mcq = (McQueContent) list.get(0);
+ return mcq;
+ }
+ return null;
+ }
+
+ public List getAllQuestionEntries(final long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID).setLong("mcContentId", mcContentId)
+ .list();
+
+ return list;
+ }
+
+ public List refreshQuestionContent(final Long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(REFRESH_QUESTION_CONTENT).setLong("mcContentId", mcContentId.longValue())
+ .list();
+
+ return list;
+ }
+
+ public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT).setString("question", question)
+ .setLong("mcContentUid", mcContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McQueContent mcq = (McQueContent) list.get(0);
+ return mcq;
+ }
+ return null;
+ }
+
+ public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER)
+ .setLong("displayOrder", displayOrder.longValue()).setLong("mcContentUid", mcContentUid.longValue())
+ .list();
+
+ if (list != null && list.size() > 0) {
+ McQueContent mcq = (McQueContent) list.get(0);
+ return mcq;
+ }
+ return null;
+ }
+
+ public void removeQuestionContentByMcUid(final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
+ .setLong("mcContentId", mcContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcQueContent);
+ templ.flush();
}
+ }
+ }
-
- public void saveMcQueContent(McQueContent mcQueContent)
- {
- this.getHibernateTemplate().save(mcQueContent);
+ public void resetAllQuestions(final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID)
+ .setLong("mcContentId", mcContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.update(mcQueContent);
}
-
-
- public void saveOrUpdateMcQueContent(McQueContent mcQueContent)
- {
- this.getHibernateTemplate().saveOrUpdate(mcQueContent);
- }
-
- public void removeMcQueContentByUID(Long uid)
- {
- McQueContent mcq = (McQueContent)getHibernateTemplate().get(McQueContent.class, uid);
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcq);
- }
+ }
+ }
- public void updateMcQueContent(McQueContent mcQueContent)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcQueContent);
+ public void cleanAllQuestions(final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(CLEAN_QUESTION_CONTENT_BY_CONTENT_ID)
+ .setLong("mcContentId", mcContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcQueContent);
}
-
- public List getAllQuestionEntriesSorted(final long mcContentId)
- {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER)
- .setLong("mcContentId", mcContentId)
- .list();
+ }
+ }
- return list;
+ public void cleanAllQuestionsSimple(final Long mcContentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(CLEAN_QUESTION_CONTENT_BY_CONTENT_ID_SIMPLE)
+ .setLong("mcContentId", mcContentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ Iterator listIterator = list.iterator();
+ while (listIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcQueContent);
}
+ }
+ }
+ public List getNextAvailableDisplayOrder(final long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(GET_NEXT_AVAILABLE_DISPLAY_ORDER).setLong("mcContentId", mcContentId)
+ .list();
- public List getMcQueContentsByContentId(long mcContentId){
- return getHibernateTemplate().findByNamedParam(LOAD_QUESTION_CONTENT_BY_CONTENT_ID, "mcContentId", new Long(mcContentId));
- }
+ return list;
+ }
-
-
- public void removeMcQueContent(McQueContent mcQueContent)
- {
- if ((mcQueContent != null) && (mcQueContent.getUid() != null))
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcQueContent);
-
- }
- }
-
- public void flush()
- {
- this.getHibernateTemplate().flush();
- }
- }
\ No newline at end of file
+ public void saveMcQueContent(McQueContent mcQueContent) {
+ this.getHibernateTemplate().save(mcQueContent);
+ }
+
+ public void saveOrUpdateMcQueContent(McQueContent mcQueContent) {
+ this.getHibernateTemplate().saveOrUpdate(mcQueContent);
+ }
+
+ public void removeMcQueContentByUID(Long uid) {
+ McQueContent mcq = (McQueContent) getHibernateTemplate().get(McQueContent.class, uid);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcq);
+ }
+
+ public void updateMcQueContent(McQueContent mcQueContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcQueContent);
+ }
+
+ public List getAllQuestionEntriesSorted(final long mcContentId) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER)
+ .setLong("mcContentId", mcContentId).list();
+
+ return list;
+ }
+
+ public List getMcQueContentsByContentId(long mcContentId) {
+ return getHibernateTemplate().findByNamedParam(LOAD_QUESTION_CONTENT_BY_CONTENT_ID, "mcContentId",
+ new Long(mcContentId));
+ }
+
+ public void removeMcQueContent(McQueContent mcQueContent) {
+ if ((mcQueContent != null) && (mcQueContent.getUid() != null)) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcQueContent);
+
+ }
+ }
+
+ public void flush() {
+ this.getHibernateTemplate().flush();
+ }
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java,v
diff -u -r1.17 -r1.18
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java 17 Aug 2007 03:32:06 -0000 1.17
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java 8 May 2013 13:18:26 -0000 1.18
@@ -28,76 +28,60 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.lamsfoundation.lams.tool.mc.dao.IMcSessionDAO;
-import org.lamsfoundation.lams.tool.mc.pojos.McContent;
-import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
import org.lamsfoundation.lams.tool.mc.pojos.McSession;
import org.springframework.orm.hibernate3.HibernateCallback;
-import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* @author ozgurd
- * Hibernate implementation for database access to Mc sessions for the mc tool.
+ *
+ * Hibernate implementation for database access to Mc sessions for the mc tool.
+ *
*/
public class McSessionDAO extends HibernateDaoSupport implements IMcSessionDAO {
-
+
private static final String LOAD_MCSESSION_BY_USER = "select ms from McSession ms left join fetch "
- + "ms.mcQueUsers user where user.queUsrId=:userId";
-
- private static final String LOAD_MCSESSION_BY_MCSESSIONID = "from McSession mcs where mcs.mcSessionId=?";
-
- public McSession getMcSessionByUID(Long uid)
- {
- return (McSession) this.getHibernateTemplate()
- .get(McSession.class, uid);
+ + "ms.mcQueUsers user where user.queUsrId=:userId";
+
+ private static final String LOAD_MCSESSION_BY_MCSESSIONID = "from McSession mcs where mcs.mcSessionId=?";
+
+ public McSession getMcSessionByUID(Long uid) {
+ return (McSession) this.getHibernateTemplate().get(McSession.class, uid);
+ }
+
+ public McSession findMcSessionById(Long mcSessionId) {
+
+ List list = getSession().createQuery(LOAD_MCSESSION_BY_MCSESSIONID).setLong(0, mcSessionId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McSession mcs = (McSession) list.get(0);
+ return mcs;
}
-
- public McSession findMcSessionById(Long mcSessionId)
- {
-
- List list = getSession().createQuery(LOAD_MCSESSION_BY_MCSESSIONID)
- .setLong(0,mcSessionId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McSession mcs = (McSession) list.get(0);
- return mcs;
- }
- return null;
- }
-
- public void saveMcSession(McSession mcSession)
- {
- this.getHibernateTemplate().save(mcSession);
+ return null;
}
-
-
- public void updateMcSession(McSession mcSession)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcSession);
+
+ public void saveMcSession(McSession mcSession) {
+ this.getHibernateTemplate().save(mcSession);
}
- public void removeMcSession(McSession mcSession)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcSession);
+ public void updateMcSession(McSession mcSession) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcSession);
}
- public McSession getMcSessionByUser(final Long userId)
- {
- return (McSession) getHibernateTemplate().execute(new HibernateCallback()
- {
+ public void removeMcSession(McSession mcSession) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcSession);
+ }
- public Object doInHibernate(Session session) throws HibernateException
- {
- return session.createQuery(LOAD_MCSESSION_BY_USER)
- .setLong("userId",
- userId.longValue())
- .uniqueResult();
- }
- });
- }
-
+ public McSession getMcSessionByUser(final Long userId) {
+ return (McSession) getHibernateTemplate().execute(new HibernateCallback() {
+
+ public Object doInHibernate(Session session) throws HibernateException {
+ return session.createQuery(LOAD_MCSESSION_BY_USER).setLong("userId", userId.longValue()).uniqueResult();
+ }
+ });
+ }
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/Attic/McUploadedFileDAO.java,v
diff -u -r1.13 -r1.14
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java 17 Aug 2007 03:32:06 -0000 1.13
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java 8 May 2013 13:18:26 -0000 1.14
@@ -31,90 +31,72 @@
import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
/**
* @author Ozgur Demirtas
*/
public class McUploadedFileDAO extends HibernateDaoSupport implements IMcUploadedFileDAO {
-
- private static final String GET_UPLOADED_FILES = "from McUploadedFile mcUploadedFile where mcUploadedFile.mcContent.mcContentId = :contentId";
-
- public McUploadedFile getUploadedFileById(long submissionId)
- {
- return (McUploadedFile) this.getHibernateTemplate()
- .load(McUploadedFile.class, new Long(submissionId));
- }
-
- /**
- *
- * return null if not found
- */
- public McUploadedFile loadUploadedFileById(long submissionId)
- {
- return (McUploadedFile) this.getHibernateTemplate().get(McUploadedFile.class, new Long(submissionId));
- }
-
-
- public void updateUploadFile(McUploadedFile mcUploadedFile)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcUploadedFile);
- }
-
-
- public void saveUploadFile(McUploadedFile mcUploadedFile)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().save(mcUploadedFile);
- }
-
- public void createUploadFile(McUploadedFile mcUploadedFile)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().save(mcUploadedFile);
- }
-
- public void UpdateUploadFile(McUploadedFile mcUploadedFile)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcUploadedFile);
- }
+ private static final String GET_UPLOADED_FILES = "from McUploadedFile mcUploadedFile where mcUploadedFile.mcContent.mcContentId = :contentId";
-
- public void removeUploadFile(Long submissionId)
- {
- if (submissionId != null ) {
-
- String query = "from uploadedFile in class org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile"
- + " where uploadedFile.submissionId = ?";
- Object obj = this.getSession().createQuery(query)
- .setLong(0,submissionId.longValue())
- .uniqueResult();
- if ( obj != null ) {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(obj);
- }
- }
- }
-
- public List retrieveMcUploadedFiles(McContent mc)
- {
- List listFilenames= (List)
- (getHibernateTemplate().findByNamedParam(GET_UPLOADED_FILES, "contentId", mc.getMcContentId()));
- return listFilenames;
+ public McUploadedFile getUploadedFileById(long submissionId) {
+ return (McUploadedFile) this.getHibernateTemplate().load(McUploadedFile.class, new Long(submissionId));
+ }
+
+ /**
+ *
+ * return null if not found
+ */
+ public McUploadedFile loadUploadedFileById(long submissionId) {
+ return (McUploadedFile) this.getHibernateTemplate().get(McUploadedFile.class, new Long(submissionId));
+ }
+
+ public void updateUploadFile(McUploadedFile mcUploadedFile) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcUploadedFile);
+ }
+
+ public void saveUploadFile(McUploadedFile mcUploadedFile) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().save(mcUploadedFile);
+ }
+
+ public void createUploadFile(McUploadedFile mcUploadedFile) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().save(mcUploadedFile);
+ }
+
+ public void UpdateUploadFile(McUploadedFile mcUploadedFile) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcUploadedFile);
+ }
+
+ public void removeUploadFile(Long submissionId) {
+ if (submissionId != null) {
+
+ String query = "from uploadedFile in class org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile"
+ + " where uploadedFile.submissionId = ?";
+ Object obj = this.getSession().createQuery(query).setLong(0, submissionId.longValue()).uniqueResult();
+ if (obj != null) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(obj);
}
-
- public void deleteUploadFile(McUploadedFile mcUploadedFile)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcUploadedFile);
- }
-
- public void flush()
- {
- this.getHibernateTemplate().flush();
- }
-
-}
\ No newline at end of file
+ }
+ }
+
+ public List retrieveMcUploadedFiles(McContent mc) {
+ List listFilenames = (List) (getHibernateTemplate().findByNamedParam(
+ GET_UPLOADED_FILES, "contentId", mc.getMcContentId()));
+ return listFilenames;
+ }
+
+ public void deleteUploadFile(McUploadedFile mcUploadedFile) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcUploadedFile);
+ }
+
+ public void flush() {
+ this.getHibernateTemplate().flush();
+ }
+
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java,v
diff -u -r1.21 -r1.22
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java 15 Dec 2009 02:20:53 -0000 1.21
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java 8 May 2013 13:18:26 -0000 1.22
@@ -22,103 +22,84 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.dao.hibernate;
-import java.util.Iterator;
import java.util.List;
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.mc.dao.IMcUserDAO;
-import org.lamsfoundation.lams.tool.mc.pojos.McContent;
import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
-import org.lamsfoundation.lams.tool.mc.pojos.McSession;
-import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* @author Ozgur Demirtas
- * Hibernate implementation for database access to Mc users (learners) for the mc tool.
+ *
+ * Hibernate implementation for database access to Mc users (learners) for the mc tool.
+ *
*/
public class McUserDAO extends HibernateDaoSupport implements IMcUserDAO {
-
- private static final String CALC_MARK_STATS_FOR_SESSION = "select max(mu.lastAttemptTotalMark), min(mu.lastAttemptTotalMark), avg(mu.lastAttemptTotalMark)"
- +" from McQueUsr mu where mu.mcSessionId = :mcSessionUid";
- private static final String GET_USER_BY_USER_ID_SESSION = "from mcQueUsr in class McQueUsr where mcQueUsr.queUsrId=:queUsrId and mcQueUsr.mcSessionId=:mcSessionId";
+ private static final String CALC_MARK_STATS_FOR_SESSION = "select max(mu.lastAttemptTotalMark), min(mu.lastAttemptTotalMark), avg(mu.lastAttemptTotalMark)"
+ + " from McQueUsr mu where mu.mcSessionId = :mcSessionUid";
- private static final String GET_USER_BY_USER_ID = "from McQueUsr user where user.queUsrId=?";
-
+ private static final String GET_USER_BY_USER_ID_SESSION = "from mcQueUsr in class McQueUsr where mcQueUsr.queUsrId=:queUsrId and mcQueUsr.mcSessionId=:mcSessionId";
- public McQueUsr getMcUserByUID(Long uid)
- {
- return (McQueUsr) this.getHibernateTemplate()
- .get(McQueUsr.class, uid);
+ private static final String GET_USER_BY_USER_ID = "from McQueUsr user where user.queUsrId=?";
+
+ public McQueUsr getMcUserByUID(Long uid) {
+ return (McQueUsr) this.getHibernateTemplate().get(McQueUsr.class, uid);
+ }
+
+ public McQueUsr findMcUserById(Long userId) {
+ List list = getSession().createQuery(GET_USER_BY_USER_ID).setLong(0, userId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McQueUsr mcu = (McQueUsr) list.get(0);
+ return mcu;
}
-
-
- public McQueUsr findMcUserById(Long userId)
- {
- List list = getSession().createQuery(GET_USER_BY_USER_ID)
- .setLong(0,userId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McQueUsr mcu = (McQueUsr) list.get(0);
- return mcu;
- }
- return null;
+ return null;
+ }
+
+ public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId) {
+
+ List list = getSession().createQuery(GET_USER_BY_USER_ID_SESSION).setLong("queUsrId", queUsrId.longValue())
+ .setLong("mcSessionId", mcSessionId.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ McQueUsr usr = (McQueUsr) list.get(0);
+ return usr;
}
-
- public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId)
- {
-
- List list = getSession().createQuery(GET_USER_BY_USER_ID_SESSION)
- .setLong("queUsrId", queUsrId.longValue())
- .setLong("mcSessionId", mcSessionId.longValue())
- .list();
-
- if(list != null && list.size() > 0){
- McQueUsr usr = (McQueUsr) list.get(0);
- return usr;
- }
- return null;
- }
+ return null;
+ }
-
- public void saveMcUser(McQueUsr mcUser)
- {
- this.getHibernateTemplate().save(mcUser);
+ public void saveMcUser(McQueUsr mcUser) {
+ this.getHibernateTemplate().save(mcUser);
}
-
- public void updateMcUser(McQueUsr mcUser)
- {
- this.getHibernateTemplate().update(mcUser);
+ public void updateMcUser(McQueUsr mcUser) {
+ this.getHibernateTemplate().update(mcUser);
}
-
- public void removeMcUser(McQueUsr mcUser)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcUser);
+
+ public void removeMcUser(McQueUsr mcUser) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcUser);
}
-
+
/** Get the max, min and average mark (in that order) for a session */
- public Integer[] getMarkStatisticsForSession(Long sessionUid)
- {
- Object[] stats = (Object[]) getSession().createQuery(CALC_MARK_STATS_FOR_SESSION)
- .setLong("mcSessionUid",sessionUid.longValue())
- .uniqueResult();
-
- if (stats!= null) {
- if (stats[2] instanceof Float) {
- return new Integer[]{(Integer)stats[0], (Integer)stats[1], new Integer(((Float)stats[2]).intValue())};
- } else if(stats[2] instanceof Double) {
- return new Integer[]{(Integer)stats[0], (Integer)stats[1], new Integer(((Double)stats[2]).intValue())};
- }
- }
-
- return null;
+ public Integer[] getMarkStatisticsForSession(Long sessionUid) {
+ Object[] stats = (Object[]) getSession().createQuery(CALC_MARK_STATS_FOR_SESSION)
+ .setLong("mcSessionUid", sessionUid.longValue()).uniqueResult();
- }
+ if (stats != null) {
+ if (stats[2] instanceof Float) {
+ return new Integer[] { (Integer) stats[0], (Integer) stats[1],
+ new Integer(((Float) stats[2]).intValue()) };
+ } else if (stats[2] instanceof Double) {
+ return new Integer[] { (Integer) stats[0], (Integer) stats[1],
+ new Integer(((Double) stats[2]).intValue()) };
+ }
+ }
+ return null;
-
+ }
+
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java,v
diff -u -r1.22 -r1.23
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java 8 May 2013 13:03:18 -0000 1.22
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUsrAttemptDAO.java 8 May 2013 13:18:26 -0000 1.23
@@ -24,114 +24,101 @@
import java.util.List;
-import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.mc.dao.IMcUsrAttemptDAO;
import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt;
-import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* @author Ozgur Demirtas
- * Hibernate implementation for database access to McUsrAttempt for the mc tool.
- * Be very careful about the queUserId and the McQueUser.uid fields. McQueUser.queUsrId is the core's user id for this user and McQueUser.uid
- * is the primary key for McQueUser. McUsrAttempt.queUsrId = McQueUser.uid, not McUsrAttempt.queUsrId = McQueUser.queUsrId
- * as you would expect. A new McQueUser object is created for each new tool session, so if the McQueUser.uid is supplied, then this
- * denotes one user in a particular tool session, but if McQueUser.queUsrId is supplied, then this is just the user, not the session and the session
- * must also be checked.
+ *
+ * Hibernate implementation for database access to McUsrAttempt for the mc tool.
+ *
+ *
+ * Be very careful about the queUserId and the McQueUser.uid fields. McQueUser.queUsrId is the core's user id
+ * for this user and McQueUser.uid is the primary key for McQueUser. McUsrAttempt.queUsrId = McQueUser.uid, not
+ * McUsrAttempt.queUsrId = McQueUser.queUsrId as you would expect. A new McQueUser object is created for each
+ * new tool session, so if the McQueUser.uid is supplied, then this denotes one user in a particular tool
+ * session, but if McQueUser.queUsrId is supplied, then this is just the user, not the session and the session
+ * must also be checked.
*/
public class McUsrAttemptDAO extends HibernateDaoSupport implements IMcUsrAttemptDAO {
-
- private static final String LOAD_ATTEMPT_BY_USER_SESSION = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrUid";
-
- private static final String LOAD_ATTEMPT_BY_ATTEMPT_ORDER = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrUid"
- +" and mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.attemptOrder=:attemptOrder"
- +" order by mcUsrAttempt.attemptOrder, mcUsrAttempt.mcOptionsContent.uid";
-
- private static final String LOAD_LAST_ATTEMPT_BY_ATTEMPT_ORDER = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.mcQueUsr.uid=:queUsrUid"
- +" and mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.attemptOrder=mcUsrAttempt.mcQueUsr.lastAttemptOrder"
- +" order by mcUsrAttempt.mcOptionsContent.uid";
- private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT = "from mcUsrAttempt in class McUsrAttempt "
- +" where mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.queUsrId=:queUsrUid"
- +" order by mcUsrAttempt.attemptOrder";
+ private static final String LOAD_ATTEMPT_BY_USER_SESSION = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrUid";
- private static final String LOAD_LAST_ATTEMPTS = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.mcQueUsr.uid=:queUsrUid"
- +" and mcUsrAttempt.attemptOrder=mcUsrAttempt.mcQueUsr.lastAttemptOrder"
- +" order by mcUsrAttempt.mcQueContentId, mcUsrAttempt.mcOptionsContent.uid";
-
- public McUsrAttempt getMcUserAttemptByUID(Long uid)
- {
- return (McUsrAttempt) this.getHibernateTemplate()
- .get(McUsrAttempt.class, uid);
- }
-
- public void saveMcUsrAttempt(McUsrAttempt mcUsrAttempt)
- {
- this.getHibernateTemplate().save(mcUsrAttempt);
- }
-
- public List getUserAttemptsForSession(Long queUsrUid)
- {
- List list = getSession().createQuery(LOAD_ATTEMPT_BY_USER_SESSION)
- .setLong("queUsrUid", queUsrUid.longValue())
- .list();
-
- return list;
- }
-
- public List getLatestAttemptsForAUser(final Long queUserUid) {
- return (List) getSession().createQuery(LOAD_LAST_ATTEMPTS)
- .setLong("queUsrUid", queUserUid.longValue())
- .list();
- }
+ private static final String LOAD_ATTEMPT_BY_ATTEMPT_ORDER = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.queUsrId=:queUsrUid"
+ + " and mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.attemptOrder=:attemptOrder"
+ + " order by mcUsrAttempt.attemptOrder, mcUsrAttempt.mcOptionsContent.uid";
- // should be able to get rid of this one by rewriting export portfolio
- @SuppressWarnings("unchecked")
- public List getLatestAttemptsForAUserForOneQuestionContent(final Long queUsrUid, final Long mcQueContentId) {
- return (List) getSession().createQuery(LOAD_LAST_ATTEMPT_BY_ATTEMPT_ORDER)
- .setLong("queUsrUid", queUsrUid.longValue())
- .setLong("mcQueContentId", mcQueContentId.longValue())
- .list();
- }
+ private static final String LOAD_LAST_ATTEMPT_BY_ATTEMPT_ORDER = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.mcQueUsr.uid=:queUsrUid"
+ + " and mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.attemptOrder=mcUsrAttempt.mcQueUsr.lastAttemptOrder"
+ + " order by mcUsrAttempt.mcOptionsContent.uid";
- @SuppressWarnings("unchecked")
- public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(final Long queUsrUid, final Long mcQueContentId)
- {
- return (List)getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT)
- .setLong("mcQueContentId", mcQueContentId.longValue())
- .setLong("queUsrUid", queUsrUid.longValue())
- .list();
- }
+ private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT = "from mcUsrAttempt in class McUsrAttempt "
+ + " where mcUsrAttempt.mcQueContentId=:mcQueContentId and mcUsrAttempt.queUsrId=:queUsrUid"
+ + " order by mcUsrAttempt.attemptOrder";
- public List getAttemptByAttemptOrder(final Long queUsrUid, final Long mcQueContentId, final Integer attemptOrder)
- {
- List list = getSession().createQuery(LOAD_ATTEMPT_BY_ATTEMPT_ORDER)
- .setLong("queUsrUid", queUsrUid.longValue())
- .setLong("mcQueContentId", mcQueContentId.longValue())
- .setInteger("attemptOrder", attemptOrder.intValue())
- .list();
- return list;
- }
-
- public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().update(mcUsrAttempt);
- }
-
- public void removeMcUsrAttemptByUID(Long uid)
- {
- McUsrAttempt mca = (McUsrAttempt)getHibernateTemplate().get(McUsrAttempt.class, uid);
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mca);
- }
-
-
- public void removeMcUsrAttempt(McUsrAttempt mcUsrAttempt)
- {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().delete(mcUsrAttempt);
- }
-
-}
\ No newline at end of file
+ private static final String LOAD_LAST_ATTEMPTS = "from mcUsrAttempt in class McUsrAttempt where mcUsrAttempt.mcQueUsr.uid=:queUsrUid"
+ + " and mcUsrAttempt.attemptOrder=mcUsrAttempt.mcQueUsr.lastAttemptOrder"
+ + " order by mcUsrAttempt.mcQueContentId, mcUsrAttempt.mcOptionsContent.uid";
+
+ public McUsrAttempt getMcUserAttemptByUID(Long uid) {
+ return (McUsrAttempt) this.getHibernateTemplate().get(McUsrAttempt.class, uid);
+ }
+
+ public void saveMcUsrAttempt(McUsrAttempt mcUsrAttempt) {
+ this.getHibernateTemplate().save(mcUsrAttempt);
+ }
+
+ public List getUserAttemptsForSession(Long queUsrUid) {
+ List list = getSession().createQuery(LOAD_ATTEMPT_BY_USER_SESSION).setLong("queUsrUid", queUsrUid.longValue())
+ .list();
+
+ return list;
+ }
+
+ public List getLatestAttemptsForAUser(final Long queUserUid) {
+ return (List) getSession().createQuery(LOAD_LAST_ATTEMPTS).setLong("queUsrUid", queUserUid.longValue()).list();
+ }
+
+ // should be able to get rid of this one by rewriting export portfolio
+ @SuppressWarnings("unchecked")
+ public List getLatestAttemptsForAUserForOneQuestionContent(final Long queUsrUid,
+ final Long mcQueContentId) {
+ return (List) getSession().createQuery(LOAD_LAST_ATTEMPT_BY_ATTEMPT_ORDER)
+ .setLong("queUsrUid", queUsrUid.longValue()).setLong("mcQueContentId", mcQueContentId.longValue())
+ .list();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(final Long queUsrUid,
+ final Long mcQueContentId) {
+ return (List) getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT)
+ .setLong("mcQueContentId", mcQueContentId.longValue()).setLong("queUsrUid", queUsrUid.longValue())
+ .list();
+ }
+
+ public List getAttemptByAttemptOrder(final Long queUsrUid, final Long mcQueContentId, final Integer attemptOrder) {
+ List list = getSession().createQuery(LOAD_ATTEMPT_BY_ATTEMPT_ORDER).setLong("queUsrUid", queUsrUid.longValue())
+ .setLong("mcQueContentId", mcQueContentId.longValue())
+ .setInteger("attemptOrder", attemptOrder.intValue()).list();
+ return list;
+ }
+
+ public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().update(mcUsrAttempt);
+ }
+
+ public void removeMcUsrAttemptByUID(Long uid) {
+ McUsrAttempt mca = (McUsrAttempt) getHibernateTemplate().get(McUsrAttempt.class, uid);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mca);
+ }
+
+ public void removeMcUsrAttempt(McUsrAttempt mcUsrAttempt) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(mcUsrAttempt);
+ }
+
+}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java,v
diff -u -r1.19 -r1.20
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java 8 May 2013 13:03:18 -0000 1.19
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McContent.java 8 May 2013 13:18:26 -0000 1.20
@@ -27,20 +27,17 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.log4j.Logger;
import org.lamsfoundation.lams.contentrepository.ItemNotFoundException;
import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
/**
- * Persistent object/bean that defines the content for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
- * It maps to database table: tl_lamc11_content
+ *
+ * Persistent object/bean that defines the content for the MCQ tool. Provides accessors and mutators to get/set
+ * attributes It maps to database table: tl_lamc11_content
*
*
* @author Ozgur Demirtas
@@ -52,7 +49,7 @@
/** persistent field */
private Long mcContentId;
-
+
/** persistent field, used for export portfolio */
private String content;
@@ -90,65 +87,65 @@
/** nullable persistent field */
private String onlineInstructions;
-
/** nullable persistent field */
private boolean retries;
-
+
private boolean showReport;
-
+
private boolean randomize;
-
+
private boolean displayAnswers;
private boolean showMarks;
-
+
/* LDEV-2657 */
private Date submissionDeadline;
-
+
/** nullable persistent field */
private Integer passMark;
private String reflectionSubject;
-
+
/** persistent field */
private Set mcQueContents;
/** persistent field */
private Set mcSessions;
-
+
/** persistent field */
private Set mcAttachments;
/** full constructor */
- public McContent(Long mcContentId, String content, String title, String instructions, boolean defineLater, boolean runOffline, Date creationDate,
- Date updateDate, boolean questionsSequenced, long createdBy, boolean contentInUse, String offlineInstructions, String onlineInstructions,
- Integer passMark, boolean showReport, boolean randomize, boolean displayAnswers, boolean showMarks, boolean retries, boolean reflect, String reflectionSubject, Set mcQueContents, Set mcSessions,
- Set mcAttachments) {
-
- this.mcContentId = mcContentId;
- this.content=content;
- this.title = title;
- this.instructions = instructions;
- this.defineLater = defineLater;
- this.runOffline = runOffline;
- this.creationDate = creationDate;
- this.updateDate = updateDate;
- this.questionsSequenced = questionsSequenced;
- this.createdBy = createdBy;
- this.contentInUse = contentInUse;
- this.offlineInstructions = offlineInstructions;
- this.onlineInstructions = onlineInstructions;
- this.retries=retries;
- this.reflectionSubject=reflectionSubject;
- this.reflect=reflect;
- this.passMark = passMark;
- this.showReport = showReport;
- this.randomize = randomize;
- this.displayAnswers = displayAnswers;
- this.showMarks = showMarks;
- this.mcQueContents = mcQueContents;
- this.mcSessions = mcSessions;
- this.mcAttachments = mcAttachments;
+ public McContent(Long mcContentId, String content, String title, String instructions, boolean defineLater,
+ boolean runOffline, Date creationDate, Date updateDate, boolean questionsSequenced, long createdBy,
+ boolean contentInUse, String offlineInstructions, String onlineInstructions, Integer passMark,
+ boolean showReport, boolean randomize, boolean displayAnswers, boolean showMarks, boolean retries,
+ boolean reflect, String reflectionSubject, Set mcQueContents, Set mcSessions, Set mcAttachments) {
+
+ this.mcContentId = mcContentId;
+ this.content = content;
+ this.title = title;
+ this.instructions = instructions;
+ this.defineLater = defineLater;
+ this.runOffline = runOffline;
+ this.creationDate = creationDate;
+ this.updateDate = updateDate;
+ this.questionsSequenced = questionsSequenced;
+ this.createdBy = createdBy;
+ this.contentInUse = contentInUse;
+ this.offlineInstructions = offlineInstructions;
+ this.onlineInstructions = onlineInstructions;
+ this.retries = retries;
+ this.reflectionSubject = reflectionSubject;
+ this.reflect = reflect;
+ this.passMark = passMark;
+ this.showReport = showReport;
+ this.randomize = randomize;
+ this.displayAnswers = displayAnswers;
+ this.showMarks = showMarks;
+ this.mcQueContents = mcQueContents;
+ this.mcSessions = mcSessions;
+ this.mcAttachments = mcAttachments;
}
/** default constructor */
@@ -157,391 +154,382 @@
/** minimal constructor */
public McContent(Long mcContentId, Set mcQueContents, Set mcSessions) {
- this.mcContentId = mcContentId;
- this.mcQueContents = mcQueContents;
- this.mcSessions = mcSessions;
+ this.mcContentId = mcContentId;
+ this.mcQueContents = mcQueContents;
+ this.mcSessions = mcSessions;
}
-
-
+
/**
- * gets called as part of the copyToolContent
- *
- * Copy Construtor to create a new mc content instance. Note that we
- * don't copy the mc session data here because the mc session
- * will be created after we copied tool content.
- * @param mc the original mc content.
- * @param newContentId the new mc content id.
+ * gets called as part of the copyToolContent
+ *
+ * Copy Construtor to create a new mc content instance. Note that we don't copy the mc session data here because the
+ * mc session will be created after we copied tool content.
+ *
+ * @param mc
+ * the original mc content.
+ * @param newContentId
+ * the new mc content id.
* @return the new mc content object.
*/
- public static McContent newInstance(IToolContentHandler toolContentHandler, McContent mc,
- Long newContentId)
- throws ItemNotFoundException, RepositoryCheckedException
- {
- McContent newContent = new McContent(
- newContentId,
- mc.getContent(),
- mc.getTitle(),
- mc.getInstructions(),
- mc.isDefineLater(),
- mc.isRunOffline(),
- mc.getCreationDate(),
- mc.getUpdateDate(),
- mc.isQuestionsSequenced(),
- mc.getCreatedBy(),
- mc.isContentInUse(),
- mc.getOfflineInstructions(),
- mc.getOnlineInstructions(),
- mc.getPassMark(),
- mc.isShowReport(),
- mc.isRandomize(),
- mc.isDisplayAnswers(),
- mc.isShowMarks(),
- mc.isRetries(),
- mc.isReflect(),
- mc.getReflectionSubject(),
- new TreeSet(),
- new TreeSet(),
- new TreeSet()
- );
- newContent.setMcQueContents(mc.deepCopyMcQueContent(newContent));
- newContent.setMcAttachments(mc.deepCopyMcAttachments(toolContentHandler, newContent));
-
- return newContent;
- }
-
+ public static McContent newInstance(IToolContentHandler toolContentHandler, McContent mc, Long newContentId)
+ throws ItemNotFoundException, RepositoryCheckedException {
+ McContent newContent = new McContent(newContentId, mc.getContent(), mc.getTitle(), mc.getInstructions(),
+ mc.isDefineLater(), mc.isRunOffline(), mc.getCreationDate(), mc.getUpdateDate(),
+ mc.isQuestionsSequenced(), mc.getCreatedBy(), mc.isContentInUse(), mc.getOfflineInstructions(),
+ mc.getOnlineInstructions(), mc.getPassMark(), mc.isShowReport(), mc.isRandomize(),
+ mc.isDisplayAnswers(), mc.isShowMarks(), mc.isRetries(), mc.isReflect(), mc.getReflectionSubject(),
+ new TreeSet(), new TreeSet(), new TreeSet());
+ newContent.setMcQueContents(mc.deepCopyMcQueContent(newContent));
+ newContent.setMcAttachments(mc.deepCopyMcAttachments(toolContentHandler, newContent));
+
+ return newContent;
+ }
+
/**
* gets called as part of the copyToolContent
*
* @param newQaContent
* @return Set
*/
- public Set deepCopyMcQueContent(McContent newMcContent)
- {
-
- Set newMcQueContent = new TreeSet();
- for (Iterator i = this.getMcQueContents().iterator(); i.hasNext();)
- {
- McQueContent queContent = (McQueContent) i.next();
- if (queContent.getMcContent() != null)
- {
- McQueContent mcQueContent=McQueContent.newInstance(queContent,
- newMcContent);
- newMcQueContent.add(mcQueContent);
- }
- }
- return newMcQueContent;
+ public Set deepCopyMcQueContent(McContent newMcContent) {
+
+ Set newMcQueContent = new TreeSet();
+ for (Iterator i = this.getMcQueContents().iterator(); i.hasNext();) {
+ McQueContent queContent = (McQueContent) i.next();
+ if (queContent.getMcContent() != null) {
+ McQueContent mcQueContent = McQueContent.newInstance(queContent, newMcContent);
+ newMcQueContent.add(mcQueContent);
+ }
+ }
+ return newMcQueContent;
}
-
+
/**
* gets called as part of the copyToolContent
*
* @param newMcContent
* @return Set
*/
- public Set deepCopyMcAttachments(IToolContentHandler toolContentHandler,McContent newMcContent)
- throws ItemNotFoundException, RepositoryCheckedException
- {
- Set newMcQueContent = new TreeSet();
- for (Iterator i = this.getMcAttachments().iterator(); i.hasNext();)
- {
- McUploadedFile mcUploadedFile = (McUploadedFile) i.next();
- if (mcUploadedFile.getMcContent() != null)
- {
- McUploadedFile newMcUploadedFile=McUploadedFile.newInstance(toolContentHandler, mcUploadedFile,
- newMcContent);
- newMcQueContent.add(newMcUploadedFile);
- }
- }
- return newMcQueContent;
+ public Set deepCopyMcAttachments(IToolContentHandler toolContentHandler, McContent newMcContent)
+ throws ItemNotFoundException, RepositoryCheckedException {
+ Set newMcQueContent = new TreeSet();
+ for (Iterator i = this.getMcAttachments().iterator(); i.hasNext();) {
+ McUploadedFile mcUploadedFile = (McUploadedFile) i.next();
+ if (mcUploadedFile.getMcContent() != null) {
+ McUploadedFile newMcUploadedFile = McUploadedFile.newInstance(toolContentHandler, mcUploadedFile,
+ newMcContent);
+ newMcQueContent.add(newMcUploadedFile);
+ }
+ }
+ return newMcQueContent;
}
-
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
public Long getMcContentId() {
- return this.mcContentId;
+ return this.mcContentId;
}
public void setMcContentId(Long mcContentId) {
- this.mcContentId = mcContentId;
+ this.mcContentId = mcContentId;
}
public String getTitle() {
- return this.title;
+ return this.title;
}
public void setTitle(String title) {
- this.title = title;
+ this.title = title;
}
public String getInstructions() {
- return this.instructions;
+ return this.instructions;
}
public void setInstructions(String instructions) {
- this.instructions = instructions;
+ this.instructions = instructions;
}
public boolean isDefineLater() {
- return this.defineLater;
+ return this.defineLater;
}
public void setDefineLater(boolean defineLater) {
- this.defineLater = defineLater;
+ this.defineLater = defineLater;
}
public boolean isRunOffline() {
- return this.runOffline;
+ return this.runOffline;
}
public void setRunOffline(boolean runOffline) {
- this.runOffline = runOffline;
+ this.runOffline = runOffline;
}
public Date getUpdateDate() {
- return this.updateDate;
+ return this.updateDate;
}
public void setUpdateDate(Date updateDate) {
- this.updateDate = updateDate;
+ this.updateDate = updateDate;
}
public boolean isQuestionsSequenced() {
- return this.questionsSequenced;
+ return this.questionsSequenced;
}
public void setQuestionsSequenced(boolean questionsSequenced) {
- this.questionsSequenced = questionsSequenced;
+ this.questionsSequenced = questionsSequenced;
}
public long getCreatedBy() {
- return this.createdBy;
+ return this.createdBy;
}
public void setCreatedBy(long createdBy) {
- this.createdBy = createdBy;
+ this.createdBy = createdBy;
}
public boolean isContentInUse() {
- return this.contentInUse;
+ return this.contentInUse;
}
public void setContentInUse(boolean contentInUse) {
- this.contentInUse = contentInUse;
+ this.contentInUse = contentInUse;
}
public String getOfflineInstructions() {
- return this.offlineInstructions;
+ return this.offlineInstructions;
}
public void setOfflineInstructions(String offlineInstructions) {
- this.offlineInstructions = offlineInstructions;
+ this.offlineInstructions = offlineInstructions;
}
public String getOnlineInstructions() {
- return this.onlineInstructions;
+ return this.onlineInstructions;
}
public void setOnlineInstructions(String onlineInstructions) {
- this.onlineInstructions = onlineInstructions;
+ this.onlineInstructions = onlineInstructions;
}
public Integer getPassMark() {
- return this.passMark;
+ return this.passMark;
}
public void setPassMark(Integer passMark) {
- this.passMark = passMark;
+ this.passMark = passMark;
}
-
public Set getMcQueContents() {
- if (this.mcQueContents == null)
- setMcQueContents(new HashSet());
- return this.mcQueContents;
+ if (this.mcQueContents == null)
+ setMcQueContents(new HashSet());
+ return this.mcQueContents;
}
-
public void setMcQueContents(Set mcQueContents) {
- this.mcQueContents = mcQueContents;
+ this.mcQueContents = mcQueContents;
}
public Set getMcSessions() {
- if (this.mcSessions == null)
- setMcSessions(new HashSet());
- return this.mcSessions;
+ if (this.mcSessions == null)
+ setMcSessions(new HashSet());
+ return this.mcSessions;
}
public void setMcSessions(Set mcSessions) {
- this.mcSessions = mcSessions;
+ this.mcSessions = mcSessions;
}
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).toString();
}
-
+
/**
- * @return Returns the retries.
- */
- public boolean isRetries() {
- return retries;
- }
- /**
- * @param retries The retries to set.
- */
- public void setRetries(boolean retries) {
- this.retries = retries;
- }
+ * @return Returns the retries.
+ */
+ public boolean isRetries() {
+ return retries;
+ }
- /**
- * @return Returns the showReport.
- */
- public boolean isShowReport() {
- return showReport;
- }
- /**
- * @param showReport The showReport to set.
- */
- public void setShowReport(boolean showReport) {
- this.showReport = showReport;
- }
- /**
- * @return Returns the mcAttachments.
- */
- public Set getMcAttachments() {
- if(mcAttachments == null)
- mcAttachments = new TreeSet();
+ /**
+ * @param retries
+ * The retries to set.
+ */
+ public void setRetries(boolean retries) {
+ this.retries = retries;
+ }
- return mcAttachments;
- }
- /**
- * @param mcAttachments The mcAttachments to set.
- */
- public void setMcAttachments(Set mcAttachments) {
- this.mcAttachments = mcAttachments;
- }
- /**
- * @return Returns the creationDate.
- */
- public Date getCreationDate() {
- return creationDate;
- }
- /**
- * @param creationDate The creationDate to set.
- */
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
- /**
- * @return Returns the content.
- */
- public String getContent() {
- return content;
- }
- /**
- * @param content The content to set.
- */
- public void setContent(String content) {
- this.content = content;
- }
/**
+ * @return Returns the showReport.
+ */
+ public boolean isShowReport() {
+ return showReport;
+ }
+
+ /**
+ * @param showReport
+ * The showReport to set.
+ */
+ public void setShowReport(boolean showReport) {
+ this.showReport = showReport;
+ }
+
+ /**
+ * @return Returns the mcAttachments.
+ */
+ public Set getMcAttachments() {
+ if (mcAttachments == null)
+ mcAttachments = new TreeSet();
+
+ return mcAttachments;
+ }
+
+ /**
+ * @param mcAttachments
+ * The mcAttachments to set.
+ */
+ public void setMcAttachments(Set mcAttachments) {
+ this.mcAttachments = mcAttachments;
+ }
+
+ /**
+ * @return Returns the creationDate.
+ */
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ /**
+ * @param creationDate
+ * The creationDate to set.
+ */
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * @param content
+ * The content to set.
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ /**
* @return Returns the reflect.
*/
public boolean isReflect() {
- return reflect;
+ return reflect;
}
+
/**
- * @param reflect The reflect to set.
+ * @param reflect
+ * The reflect to set.
*/
public void setReflect(boolean reflect) {
- this.reflect = reflect;
+ this.reflect = reflect;
}
-
+
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 showMarks.
*/
public boolean isShowMarks() {
- return showMarks;
+ return showMarks;
}
+
/**
- * @param showMarks The showMarks to set.
+ * @param showMarks
+ * The showMarks to set.
*/
public void setShowMarks(boolean showMarks) {
- this.showMarks = showMarks;
+ this.showMarks = showMarks;
}
+
/**
* @return Returns the randomize.
*/
public boolean isRandomize() {
- return randomize;
+ return randomize;
}
+
/**
- * @param randomize The randomize to set.
+ * @param randomize
+ * The randomize to set.
*/
public void setRandomize(boolean randomize) {
- this.randomize = randomize;
+ this.randomize = randomize;
}
+
/**
* @return Returns the displayAnswers.
*/
public boolean isDisplayAnswers() {
- return displayAnswers;
+ return displayAnswers;
}
+
/**
- * @param displayAnswers The displayAnswers to set.
+ * @param displayAnswers
+ * The displayAnswers to set.
*/
public void setDisplayAnswers(boolean displayAnswers) {
- this.displayAnswers = displayAnswers;
+ this.displayAnswers = displayAnswers;
}
-
-
- /**
- * @return date submissionDeadline
- */
- public Date getSubmissionDeadline() {
- return submissionDeadline;
- }
-
- public void setSubmissionDeadline(Date submissionDeadline) {
- this.submissionDeadline = submissionDeadline;
- }
-
/**
- * Get total possible marks for this content. Iterates over the McQueContents set
+ * @return date submissionDeadline
*/
+ public Date getSubmissionDeadline() {
+ return submissionDeadline;
+ }
+
+ public void setSubmissionDeadline(Date submissionDeadline) {
+ this.submissionDeadline = submissionDeadline;
+ }
+
+ /**
+ * Get total possible marks for this content. Iterates over the McQueContents set
+ */
public Integer getTotalMarksPossible() {
- int totalMarksPossible=0;
- Iterator itQuestions=getMcQueContents().iterator() ;
- while (itQuestions.hasNext())
- {
- McQueContent mcQueContent = (McQueContent)itQuestions.next();
- Integer mark=mcQueContent.getMark();
- totalMarksPossible += (mark!=null ? mark.intValue() : 0);
- }
-
- return new Integer(totalMarksPossible);
+ int totalMarksPossible = 0;
+ Iterator itQuestions = getMcQueContents().iterator();
+ while (itQuestions.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) itQuestions.next();
+ Integer mark = mcQueContent.getMark();
+ totalMarksPossible += (mark != null ? mark.intValue() : 0);
+ }
+
+ return new Integer(totalMarksPossible);
}
-
+
public boolean isPassMarkApplicable() {
- return passMark != null;
+ return passMark != null;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McOptsContent.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McOptsContent.java,v
diff -u -r1.5 -r1.6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McOptsContent.java 8 May 2013 13:03:18 -0000 1.5
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McOptsContent.java 8 May 2013 13:18:26 -0000 1.6
@@ -28,183 +28,182 @@
import java.util.TreeSet;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.log4j.Logger;
-
/**
- * Persistent object/bean that defines the content for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
- * It maps to database table: tl_lamc11_options_content
+ *
+ * Persistent object/bean that defines the content for the MCQ tool. Provides accessors and mutators to get/set
+ * attributes It maps to database table: tl_lamc11_options_content
*
*
* @author Ozgur Demirtas
- */
+ */
public class McOptsContent implements Serializable, Comparable {
-
+
/** identifier field */
private Long uid;
-
+
private Long mcQueOptionId;
-
+
/** nullable persistent field */
private boolean correctOption;
/** nullable persistent field */
private String mcQueOptionText;
-
+
private Integer displayOrder;
/** non persistent field */
private Long mcQueContentId;
-
+
/** persistent field */
private org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent;
-
+
/** persistent field */
private Set mcUsrAttempts;
-
- public McOptsContent(Long mcQueOptionId, boolean correctOption, String mcQueOptionText, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
- this.mcQueOptionId=mcQueOptionId;
- this.correctOption = correctOption;
- this.mcQueOptionText = mcQueOptionText;
- this.mcQueContent = mcQueContent;
- this.mcUsrAttempts=mcUsrAttempts;
+ public McOptsContent(Long mcQueOptionId, boolean correctOption, String mcQueOptionText,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
+ this.mcQueOptionId = mcQueOptionId;
+ this.correctOption = correctOption;
+ this.mcQueOptionText = mcQueOptionText;
+ this.mcQueContent = mcQueContent;
+ this.mcUsrAttempts = mcUsrAttempts;
}
-
-
- public McOptsContent(boolean correctOption, String mcQueOptionText, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
- this.correctOption = correctOption;
- this.mcQueOptionText = mcQueOptionText;
- this.mcQueContent = mcQueContent;
- this.mcUsrAttempts=mcUsrAttempts;
+
+ public McOptsContent(boolean correctOption, String mcQueOptionText,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
+ this.correctOption = correctOption;
+ this.mcQueOptionText = mcQueOptionText;
+ this.mcQueContent = mcQueContent;
+ this.mcUsrAttempts = mcUsrAttempts;
}
- public McOptsContent(Integer displayOrder, boolean correctOption, String mcQueOptionText, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
- this.displayOrder = displayOrder;
- this.correctOption = correctOption;
- this.mcQueOptionText = mcQueOptionText;
- this.mcQueContent = mcQueContent;
- this.mcUsrAttempts=mcUsrAttempts;
+
+ public McOptsContent(Integer displayOrder, boolean correctOption, String mcQueOptionText,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, Set mcUsrAttempts) {
+ this.displayOrder = displayOrder;
+ this.correctOption = correctOption;
+ this.mcQueOptionText = mcQueOptionText;
+ this.mcQueContent = mcQueContent;
+ this.mcUsrAttempts = mcUsrAttempts;
}
-
- public static McOptsContent newInstance(McOptsContent mcOptsContent,
- McQueContent newMcQueContent)
-
- {
- McOptsContent newMcOptsContent = new McOptsContent(mcOptsContent.getDisplayOrder(),
- mcOptsContent.isCorrectOption(),
- mcOptsContent.getMcQueOptionText(),
- newMcQueContent,
- new TreeSet());
- return newMcOptsContent;
- }
-
-
+
+ public static McOptsContent newInstance(McOptsContent mcOptsContent, McQueContent newMcQueContent)
+
+ {
+ McOptsContent newMcOptsContent = new McOptsContent(mcOptsContent.getDisplayOrder(),
+ mcOptsContent.isCorrectOption(), mcOptsContent.getMcQueOptionText(), newMcQueContent, new TreeSet());
+ return newMcOptsContent;
+ }
+
/** default constructor */
public McOptsContent() {
}
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
-
public boolean isCorrectOption() {
- return this.correctOption;
+ return this.correctOption;
}
public void setCorrectOption(boolean correctOption) {
- this.correctOption = correctOption;
+ this.correctOption = correctOption;
}
public String getMcQueOptionText() {
- return this.mcQueOptionText;
+ return this.mcQueOptionText;
}
public void setMcQueOptionText(String mcQueOptionText) {
- this.mcQueOptionText = mcQueOptionText;
+ this.mcQueOptionText = mcQueOptionText;
}
public org.lamsfoundation.lams.tool.mc.pojos.McQueContent getMcQueContent() {
- return this.mcQueContent;
+ return this.mcQueContent;
}
public void setMcQueContent(org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent) {
- this.mcQueContent = mcQueContent;
+ this.mcQueContent = mcQueContent;
}
-
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).toString();
}
- /**
- * @return Returns the mcQueOptionId.
- */
- public Long getMcQueOptionId() {
- return mcQueOptionId;
- }
- /**
- * @param mcQueOptionId The mcQueOptionId to set.
- */
- public void setMcQueOptionId(Long mcQueOptionId) {
- this.mcQueOptionId = mcQueOptionId;
- }
- /**
- * @return Returns the mcUsrAttempts.
- */
-
-
- public Set getMcUsrAttempts() {
- if (this.mcUsrAttempts == null)
- setMcUsrAttempts(new HashSet());
- return this.mcUsrAttempts;
- }
- /**
- * @param mcUsrAttempts The mcUsrAttempts to set.
- */
- public void setMcUsrAttempts(Set mcUsrAttempts) {
- this.mcUsrAttempts = mcUsrAttempts;
- }
-
- /**
- * @return Returns the mcQueContentId.
- */
- public Long getMcQueContentId() {
- return mcQueContentId;
- }
- /**
- * @param mcQueContentId The mcQueContentId to set.
- */
- public void setMcQueContentId(Long mcQueContentId) {
- this.mcQueContentId = mcQueContentId;
- }
-
- public int compareTo(Object o)
- {
- McOptsContent optContent = (McOptsContent) o;
- //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference.
- if (mcQueOptionId == null)
- return 1;
- else
- return (int) (mcQueOptionId.longValue() - optContent.mcQueOptionId.longValue());
+ /**
+ * @return Returns the mcQueOptionId.
+ */
+ public Long getMcQueOptionId() {
+ return mcQueOptionId;
}
+
/**
+ * @param mcQueOptionId
+ * The mcQueOptionId to set.
+ */
+ public void setMcQueOptionId(Long mcQueOptionId) {
+ this.mcQueOptionId = mcQueOptionId;
+ }
+
+ /**
+ * @return Returns the mcUsrAttempts.
+ */
+
+ public Set getMcUsrAttempts() {
+ if (this.mcUsrAttempts == null)
+ setMcUsrAttempts(new HashSet());
+ return this.mcUsrAttempts;
+ }
+
+ /**
+ * @param mcUsrAttempts
+ * The mcUsrAttempts to set.
+ */
+ public void setMcUsrAttempts(Set mcUsrAttempts) {
+ this.mcUsrAttempts = mcUsrAttempts;
+ }
+
+ /**
+ * @return Returns the mcQueContentId.
+ */
+ public Long getMcQueContentId() {
+ return mcQueContentId;
+ }
+
+ /**
+ * @param mcQueContentId
+ * The mcQueContentId to set.
+ */
+ public void setMcQueContentId(Long mcQueContentId) {
+ this.mcQueContentId = mcQueContentId;
+ }
+
+ public int compareTo(Object o) {
+ McOptsContent optContent = (McOptsContent) o;
+ // if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference.
+ if (mcQueOptionId == null)
+ return 1;
+ else
+ return (int) (mcQueOptionId.longValue() - optContent.mcQueOptionId.longValue());
+ }
+
+ /**
* @return Returns the displayOrder.
*/
public Integer getDisplayOrder() {
- return displayOrder;
+ return displayOrder;
}
+
/**
- * @param displayOrder The displayOrder to set.
+ * @param displayOrder
+ * The displayOrder to set.
*/
public void setDisplayOrder(Integer displayOrder) {
- this.displayOrder = displayOrder;
+ this.displayOrder = displayOrder;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java,v
diff -u -r1.9 -r1.10
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java 8 May 2013 13:03:18 -0000 1.9
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueContent.java 8 May 2013 13:18:26 -0000 1.10
@@ -29,13 +29,11 @@
import java.util.TreeSet;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.log4j.Logger;
-
/**
- * Persistent object/bean that defines the question content for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
- * It maps to database table: tl_lamc11_que_content
+ *
+ * Persistent object/bean that defines the question content for the MCQ tool. Provides accessors and mutators to get/set
+ * attributes It maps to database table: tl_lamc11_que_content
*
*
* @author Ozgur Demirtas
@@ -53,280 +51,273 @@
/** nullable persistent field */
private Integer displayOrder;
-
+
private Integer mark;
-
+
private String feedback;
-
-
+
/** non persistent field */
private Long mcContentId;
-
+
/** persistent field */
private org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent;
-
+
/** persistent field */
private Set mcUsrAttempts;
/** persistent field */
private Set mcOptionsContents;
/** full constructor */
- public McQueContent(Long mcQueContentId, String question, Integer displayOrder, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.mcQueContentId = mcQueContentId;
- this.question = question;
- this.displayOrder = displayOrder;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(Long mcQueContentId, String question, Integer displayOrder, McContent mcContent,
+ Set mcUsrAttempts, Set mcOptionsContents) {
+ this.mcQueContentId = mcQueContentId;
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
- public McQueContent(String question, Integer displayOrder, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+
+ public McQueContent(String question, Integer displayOrder, McContent mcContent, Set mcUsrAttempts,
+ Set mcOptionsContents) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
- public McQueContent(String question, Integer displayOrder, Integer mark, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.mark = mark;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+
+ public McQueContent(String question, Integer displayOrder, Integer mark, McContent mcContent, Set mcUsrAttempts,
+ Set mcOptionsContents) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mark = mark;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
- public McQueContent(String question, Integer displayOrder, String feedback, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.feedback = feedback;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(String question, Integer displayOrder, String feedback, McContent mcContent, Set mcUsrAttempts,
+ Set mcOptionsContents) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.feedback = feedback;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
- public McQueContent(String question, Integer displayOrder, Integer mark, String feedback, McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.mark = mark;
- this.feedback = feedback;
- this.mcContent=mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(String question, Integer displayOrder, Integer mark, String feedback, McContent mcContent,
+ Set mcUsrAttempts, Set mcOptionsContents) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mark = mark;
+ this.feedback = feedback;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
-
- public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) {
- this.mcQueContentId = mcQueContentId;
- this.question = question;
- this.displayOrder = displayOrder;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Set mcUsrAttempts,
+ Set mcOptionsContents) {
+ this.mcQueContentId = mcQueContentId;
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
- public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Integer mark, Set mcUsrAttempts, Set mcOptionsContents) {
- this.mcQueContentId = mcQueContentId;
- this.question = question;
- this.displayOrder = displayOrder;
- this.mark=mark;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+
+ public McQueContent(Long mcQueContentId, String question, Integer displayOrder, Integer mark, Set mcUsrAttempts,
+ Set mcOptionsContents) {
+ this.mcQueContentId = mcQueContentId;
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mark = mark;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
-
- public McQueContent(String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) {
- this.question = question;
- this.displayOrder = displayOrder;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(String question, Integer displayOrder, Set mcUsrAttempts, Set mcOptionsContents) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
-
/** default constructor */
public McQueContent() {
}
/** minimal constructor */
- public McQueContent(Long mcQueContentId, org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcUsrAttempts, Set mcOptionsContents) {
- this.mcQueContentId = mcQueContentId;
- this.mcContent = mcContent;
- this.mcUsrAttempts = mcUsrAttempts;
- this.mcOptionsContents = mcOptionsContents;
+ public McQueContent(Long mcQueContentId, org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent,
+ Set mcUsrAttempts, Set mcOptionsContents) {
+ this.mcQueContentId = mcQueContentId;
+ this.mcContent = mcContent;
+ this.mcUsrAttempts = mcUsrAttempts;
+ this.mcOptionsContents = mcOptionsContents;
}
-
-
+
/**
- * gets called by copyToolContent
+ * gets called by copyToolContent
*
* Copy constructor
- * @param queContent the original qa question content
+ *
+ * @param queContent
+ * the original qa question content
* @return the new qa question content object
*/
- public static McQueContent newInstance(McQueContent queContent,
- McContent newMcContent)
-
+ public static McQueContent newInstance(McQueContent queContent, McContent newMcContent)
+
{
- McQueContent newQueContent = new McQueContent(queContent.getQuestion(),
- queContent.getDisplayOrder(),
- queContent.getMark(),
- queContent.getFeedback(),
- newMcContent,
- new TreeSet(),
- new TreeSet());
-
- newQueContent.setMcOptionsContents(queContent.deepCopyMcOptionsContent(newQueContent));
- return newQueContent;
+ McQueContent newQueContent = new McQueContent(queContent.getQuestion(), queContent.getDisplayOrder(),
+ queContent.getMark(), queContent.getFeedback(), newMcContent, new TreeSet(), new TreeSet());
+
+ newQueContent.setMcOptionsContents(queContent.deepCopyMcOptionsContent(newQueContent));
+ return newQueContent;
}
-
-
- public Set deepCopyMcOptionsContent(McQueContent newQueContent)
- {
- Set newMcOptionsContent = new TreeSet();
- for (Iterator i = this.getMcOptionsContents().iterator(); i.hasNext();)
- {
- McOptsContent mcOptsContent = (McOptsContent) i.next();
- McOptsContent mcNewOptsContent= McOptsContent.newInstance(mcOptsContent,newQueContent);
-
- if (mcNewOptsContent.getMcQueContent() != null)
- {
- newMcOptionsContent.add(mcNewOptsContent);
- }
- }
- return newMcOptionsContent;
+
+ public Set deepCopyMcOptionsContent(McQueContent newQueContent) {
+ Set newMcOptionsContent = new TreeSet();
+ for (Iterator i = this.getMcOptionsContents().iterator(); i.hasNext();) {
+ McOptsContent mcOptsContent = (McOptsContent) i.next();
+ McOptsContent mcNewOptsContent = McOptsContent.newInstance(mcOptsContent, newQueContent);
+
+ if (mcNewOptsContent.getMcQueContent() != null) {
+ newMcOptionsContent.add(mcNewOptsContent);
+ }
+ }
+ return newMcOptionsContent;
}
-
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
public Long getMcQueContentId() {
- return this.mcQueContentId;
+ return this.mcQueContentId;
}
public void setMcQueContentId(Long mcQueContentId) {
- this.mcQueContentId = mcQueContentId;
+ this.mcQueContentId = mcQueContentId;
}
public String getQuestion() {
- return this.question;
+ return this.question;
}
public void setQuestion(String question) {
- this.question = question;
+ this.question = question;
}
public Integer getDisplayOrder() {
- return this.displayOrder;
+ return this.displayOrder;
}
public void setDisplayOrder(Integer displayOrder) {
- this.displayOrder = displayOrder;
+ this.displayOrder = displayOrder;
}
public org.lamsfoundation.lams.tool.mc.pojos.McContent getMcContent() {
- return this.mcContent;
+ return this.mcContent;
}
public void setMcContent(org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent) {
- this.mcContent = mcContent;
+ this.mcContent = mcContent;
}
public Set getMcUsrAttempts() {
- if (this.mcUsrAttempts == null)
- setMcUsrAttempts(new HashSet());
- return this.mcUsrAttempts;
+ if (this.mcUsrAttempts == null)
+ setMcUsrAttempts(new HashSet());
+ return this.mcUsrAttempts;
}
-
public void setMcUsrAttempts(Set mcUsrAttempts) {
- this.mcUsrAttempts = mcUsrAttempts;
+ this.mcUsrAttempts = mcUsrAttempts;
}
-
public Set getMcOptionsContents() {
- if (this.mcOptionsContents == null)
- setMcOptionsContents(new HashSet());
- return this.mcOptionsContents;
+ if (this.mcOptionsContents == null)
+ setMcOptionsContents(new HashSet());
+ return this.mcOptionsContents;
}
public void setMcOptionsContents(Set mcOptionsContents) {
- this.mcOptionsContents = mcOptionsContents;
+ this.mcOptionsContents = mcOptionsContents;
}
- /** Get an options content record by its uid. Iterates
- * over the set from getMcOptionsContents(). */
+ /**
+ * Get an options content record by its uid. Iterates over the set from getMcOptionsContents().
+ */
public McOptsContent getOptionsContentByUID(Long uid) {
- Iterator iter = getMcOptionsContents().iterator();
- while (iter.hasNext()) {
- McOptsContent elem = (McOptsContent) iter.next();
- if ( elem.getUid().equals(uid))
- return elem;
- }
- return null;
+ Iterator iter = getMcOptionsContents().iterator();
+ while (iter.hasNext()) {
+ McOptsContent elem = (McOptsContent) iter.next();
+ if (elem.getUid().equals(uid))
+ return elem;
+ }
+ return null;
}
-
+
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).toString();
}
-
- /**
- * @return Returns the mcContentId.
- */
- public Long getMcContentId() {
- return mcContentId;
- }
- /**
- * @param mcContentId The mcContentId to set.
- */
- public void setMcContentId(Long mcContentId) {
- this.mcContentId = mcContentId;
- }
+
/**
+ * @return Returns the mcContentId.
+ */
+ public Long getMcContentId() {
+ return mcContentId;
+ }
+
+ /**
+ * @param mcContentId
+ * The mcContentId to set.
+ */
+ public void setMcContentId(Long mcContentId) {
+ this.mcContentId = mcContentId;
+ }
+
+ /**
* @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;
}
- public int compareTo(Object o)
- {
- McQueContent queContent = (McQueContent) o;
- //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference.
- if (mcQueContentId == null)
- return 1;
- else
- return (int) (mcQueContentId.longValue() - queContent.mcQueContentId.longValue());
+
+ public int compareTo(Object o) {
+ McQueContent queContent = (McQueContent) o;
+ // if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference.
+ if (mcQueContentId == null)
+ return 1;
+ else
+ return (int) (mcQueContentId.longValue() - queContent.mcQueContentId.longValue());
}
-
+
/**
* @return Returns the mark.
*/
public Integer getMark() {
- return mark;
+ return mark;
}
+
/**
- * @param mark The mark to set.
+ * @param mark
+ * The mark to set.
*/
public void setMark(Integer mark) {
- this.mark = mark;
+ this.mark = mark;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueUsr.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueUsr.java,v
diff -u -r1.7 -r1.8
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueUsr.java 25 Mar 2013 12:50:35 -0000 1.7
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McQueUsr.java 8 May 2013 13:18:26 -0000 1.8
@@ -28,10 +28,9 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
- * Persistent object/bean that defines the user for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
+ *
+ * Persistent object/bean that defines the user for the MCQ tool. Provides accessors and mutators to get/set attributes
* It maps to database table: tl_lamc11_que_usr
*
*
@@ -50,163 +49,163 @@
/** nullable persistent field */
private String fullname;
-
+
private boolean responseFinalised;
private Long mcSessionId;
-
+
/** nullable persistent field */
private org.lamsfoundation.lams.tool.mc.pojos.McSession mcSession;
/** persistent field */
private Set mcUsrAttempts;
private Integer lastAttemptOrder;
-
+
private Integer lastAttemptTotalMark;
-
+
/** full constructor */
- public McQueUsr(Long queUsrId, String username, String fullname, org.lamsfoundation.lams.tool.mc.pojos.McSession mcSession, Set mcUsrAttempts) {
- this.queUsrId = queUsrId;
- this.username = username;
- this.fullname = fullname;
- this.mcSession = mcSession;
- this.mcUsrAttempts = mcUsrAttempts;
+ public McQueUsr(Long queUsrId, String username, String fullname,
+ org.lamsfoundation.lams.tool.mc.pojos.McSession mcSession, Set mcUsrAttempts) {
+ this.queUsrId = queUsrId;
+ this.username = username;
+ this.fullname = fullname;
+ this.mcSession = mcSession;
+ this.mcUsrAttempts = mcUsrAttempts;
}
/**
* @return Returns the responseFinalised.
*/
public boolean isResponseFinalised() {
- return responseFinalised;
+ return responseFinalised;
}
+
/**
- * @param responseFinalised The responseFinalised to set.
+ * @param responseFinalised
+ * The responseFinalised to set.
*/
public void setResponseFinalised(boolean responseFinalised) {
- this.responseFinalised = responseFinalised;
+ this.responseFinalised = responseFinalised;
}
+
/** default constructor */
public McQueUsr() {
}
/** minimal constructor */
public McQueUsr(Long queUsrId, Set mcUsrAttempts) {
- this.queUsrId = queUsrId;
- this.mcUsrAttempts = mcUsrAttempts;
+ this.queUsrId = queUsrId;
+ this.mcUsrAttempts = mcUsrAttempts;
}
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
public Long getQueUsrId() {
- return this.queUsrId;
+ return this.queUsrId;
}
public void setQueUsrId(Long queUsrId) {
- this.queUsrId = queUsrId;
+ this.queUsrId = queUsrId;
}
public String getUsername() {
- return this.username;
+ return this.username;
}
public void setUsername(String username) {
- this.username = username;
+ this.username = username;
}
public String getFullname() {
- return this.fullname;
+ return this.fullname;
}
public void setFullname(String fullname) {
- this.fullname = fullname;
+ this.fullname = fullname;
}
-
public org.lamsfoundation.lams.tool.mc.pojos.McSession getMcSession() {
- return this.mcSession;
+ return this.mcSession;
}
public void setMcSession(org.lamsfoundation.lams.tool.mc.pojos.McSession mcSession) {
- this.mcSession = mcSession;
+ this.mcSession = mcSession;
}
public Set getMcUsrAttempts() {
- if (this.mcUsrAttempts == null)
- setMcUsrAttempts(new HashSet());
- return this.mcUsrAttempts;
+ if (this.mcUsrAttempts == null)
+ setMcUsrAttempts(new HashSet());
+ return this.mcUsrAttempts;
}
-
-
+
public void setMcUsrAttempts(Set mcUsrAttempts) {
- this.mcUsrAttempts = mcUsrAttempts;
+ this.mcUsrAttempts = mcUsrAttempts;
}
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .append("queUsrId", getQueUsrId())
- .append("username", getUsername())
- .append("fullname", getFullname())
- .append("responseFinalised", isResponseFinalised())
- .append("mcSessionId", getMcSessionId())
- .append("lastAttemptOrder", getLastAttemptOrder())
- .append("lastAttemptTotalMark", getLastAttemptTotalMark())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).append("queUsrId", getQueUsrId())
+ .append("username", getUsername()).append("fullname", getFullname())
+ .append("responseFinalised", isResponseFinalised()).append("mcSessionId", getMcSessionId())
+ .append("lastAttemptOrder", getLastAttemptOrder())
+ .append("lastAttemptTotalMark", getLastAttemptTotalMark()).toString();
}
- /**
- * @return Returns the mcSessionId.
- */
- public Long getMcSessionId() {
- return mcSessionId;
- }
- /**
- * @param mcSessionId The mcSessionId to set.
- */
- public void setMcSessionId(Long mcSessionId) {
- this.mcSessionId = mcSessionId;
- }
+ /**
+ * @return Returns the mcSessionId.
+ */
+ public Long getMcSessionId() {
+ return mcSessionId;
+ }
- public Integer getLastAttemptOrder() {
- return lastAttemptOrder;
- }
+ /**
+ * @param mcSessionId
+ * The mcSessionId to set.
+ */
+ public void setMcSessionId(Long mcSessionId) {
+ this.mcSessionId = mcSessionId;
+ }
- public void setLastAttemptOrder(Integer lastAttemptOrder) {
- this.lastAttemptOrder = lastAttemptOrder;
- }
+ public Integer getLastAttemptOrder() {
+ return lastAttemptOrder;
+ }
- public Integer getLastAttemptTotalMark() {
- return lastAttemptTotalMark;
- }
+ public void setLastAttemptOrder(Integer lastAttemptOrder) {
+ this.lastAttemptOrder = lastAttemptOrder;
+ }
- public void setLastAttemptTotalMark(Integer lastAttemptTotalMark) {
- this.lastAttemptTotalMark = lastAttemptTotalMark;
+ public Integer getLastAttemptTotalMark() {
+ return lastAttemptTotalMark;
+ }
+
+ public void setLastAttemptTotalMark(Integer lastAttemptTotalMark) {
+ this.lastAttemptTotalMark = lastAttemptTotalMark;
+ }
+
+ /**
+ * Is the latest attempt a pass? True if and only if passmark is applicable for the related content and the user's
+ * lastAttemptTotalMark >= passmark.
+ */
+ public boolean isLastAttemptMarkPassed() {
+ return isMarkPassed(lastAttemptTotalMark);
+ }
+
+ /**
+ * Does this mark count as a pass? True if and only if passmark is applicable for the related content and the given
+ * mark >= passmark. Used to calculate if the user has passed before setting up the learner's attempts.
+ */
+ public boolean isMarkPassed(Integer mark) {
+ McContent content = mcSession.getMcContent();
+ if (mark != null && content.isPassMarkApplicable()) {
+ Integer passMark = content.getPassMark();
+ return passMark != null && (mark.compareTo(passMark) >= 0);
}
-
- /** Is the latest attempt a pass? True if and only if passmark is applicable for
- * the related content and the user's lastAttemptTotalMark >= passmark.
- */
- public boolean isLastAttemptMarkPassed() {
- return isMarkPassed(lastAttemptTotalMark);
- }
-
- /** Does this mark count as a pass? True if and only if passmark is applicable for
- * the related content and the given mark >= passmark. Used to calculate
- * if the user has passed before setting up the learner's attempts.
- */
- public boolean isMarkPassed(Integer mark) {
- McContent content = mcSession.getMcContent();
- if ( mark != null && content.isPassMarkApplicable() ) {
- Integer passMark = content.getPassMark();
- return passMark!=null && (mark.compareTo(passMark) >= 0);
- }
- return false;
- }
+ return false;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McSession.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McSession.java,v
diff -u -r1.4 -r1.5
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McSession.java 17 Sep 2006 06:23:45 -0000 1.4
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McSession.java 8 May 2013 13:18:26 -0000 1.5
@@ -29,21 +29,20 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
- * Persistent object/bean that defines the content for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
- * It maps to database table: tl_lamc11_session
+ *
+ * Persistent object/bean that defines the content for the MCQ tool. Provides accessors and mutators to get/set
+ * attributes It maps to database table: tl_lamc11_session
*
*
* @author Ozgur Demirtas
*/
public class McSession implements Serializable {
- public final static String INCOMPLETE = "INCOMPLETE";
-
+ public final static String INCOMPLETE = "INCOMPLETE";
+
public static final String COMPLETED = "COMPLETED";
-
+
/** identifier field */
private Long uid;
@@ -58,7 +57,7 @@
/** nullable persistent field */
private String sessionStatus;
-
+
private String session_name;
/** nullable persistent field */
@@ -71,142 +70,156 @@
private Set mcQueUsers;
/** full constructor */
- public McSession(Long mcSessionId, Date sessionStartDate, Date sessionEndDate, String sessionStatus, org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
- this.mcSessionId = mcSessionId;
- this.sessionStartDate = sessionStartDate;
- this.sessionEndDate = sessionEndDate;
- this.sessionStatus = sessionStatus;
- this.mcContent = mcContent;
- this.mcQueUsers = mcQueUsers;
+ public McSession(Long mcSessionId, Date sessionStartDate, Date sessionEndDate, String sessionStatus,
+ org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
+ this.mcSessionId = mcSessionId;
+ this.sessionStartDate = sessionStartDate;
+ this.sessionEndDate = sessionEndDate;
+ this.sessionStatus = sessionStatus;
+ this.mcContent = mcContent;
+ this.mcQueUsers = mcQueUsers;
}
-
- public McSession(Long mcSessionId, Date sessionStartDate, String sessionStatus, String session_name, org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
- this.mcSessionId = mcSessionId;
- this.sessionStartDate = sessionStartDate;
- this.sessionStatus = sessionStatus;
- this.session_name = session_name;
- this.mcContent = mcContent;
- this.mcQueUsers = mcQueUsers;
+
+ public McSession(Long mcSessionId, Date sessionStartDate, String sessionStatus, String session_name,
+ org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
+ this.mcSessionId = mcSessionId;
+ this.sessionStartDate = sessionStartDate;
+ this.sessionStatus = sessionStatus;
+ this.session_name = session_name;
+ this.mcContent = mcContent;
+ this.mcQueUsers = mcQueUsers;
}
-
- public McSession(Long mcSessionId, Date sessionStartDate, String sessionStatus, org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
- this.mcSessionId = mcSessionId;
- this.sessionStartDate = sessionStartDate;
- this.sessionStatus = sessionStatus;
- this.mcContent = mcContent;
- this.mcQueUsers = mcQueUsers;
+
+ public McSession(Long mcSessionId, Date sessionStartDate, String sessionStatus,
+ org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent, Set mcQueUsers) {
+ this.mcSessionId = mcSessionId;
+ this.sessionStartDate = sessionStartDate;
+ this.sessionStatus = sessionStatus;
+ this.mcContent = mcContent;
+ this.mcQueUsers = mcQueUsers;
}
-
+
/** default constructor */
public McSession() {
}
/** minimal constructor */
public McSession(Long mcSessionId, Set mcQueUsers) {
- this.mcSessionId = mcSessionId;
- this.mcQueUsers = mcQueUsers;
+ this.mcSessionId = mcSessionId;
+ this.mcQueUsers = mcQueUsers;
}
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
public Long getMcSessionId() {
- return this.mcSessionId;
+ return this.mcSessionId;
}
public void setMcSessionId(Long mcSessionId) {
- this.mcSessionId = mcSessionId;
+ this.mcSessionId = mcSessionId;
}
-
public Long getMcContentId() {
- return this.mcContentId;
+ return this.mcContentId;
}
public void setMcContentId(Long mcContentId) {
- this.mcContentId = mcContentId;
+ this.mcContentId = mcContentId;
}
public org.lamsfoundation.lams.tool.mc.pojos.McContent getMcContent() {
- return this.mcContent;
+ return this.mcContent;
}
public void setMcContent(org.lamsfoundation.lams.tool.mc.pojos.McContent mcContent) {
- this.mcContent = mcContent;
+ this.mcContent = mcContent;
}
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).toString();
}
- /**
- * @return Returns the sessionEndDate.
- */
- public Date getSessionEndDate() {
- return sessionEndDate;
- }
- /**
- * @param sessionEndDate The sessionEndDate to set.
- */
- public void setSessionEndDate(Date sessionEndDate) {
- this.sessionEndDate = sessionEndDate;
- }
- /**
- * @return Returns the sessionStartDate.
- */
- public Date getSessionStartDate() {
- return sessionStartDate;
- }
- /**
- * @param sessionStartDate The sessionStartDate to set.
- */
- public void setSessionStartDate(Date sessionStartDate) {
- this.sessionStartDate = sessionStartDate;
- }
- /**
- * @return Returns the sessionStatus.
- */
- public String getSessionStatus() {
- return sessionStatus;
- }
- /**
- * @param sessionStatus The sessionStatus to set.
- */
- public void setSessionStatus(String sessionStatus) {
- this.sessionStatus = sessionStatus;
- }
- /**
- * @return Returns the mcQueUsers.
- */
-
- public Set getMcQueUsers() {
- if (this.mcQueUsers == null)
- setMcQueUsers(new HashSet());
- return this.mcQueUsers;
- }
- /**
- * @param mcQueUsers The mcQueUsers to set.
- */
- public void setMcQueUsers(Set mcQueUsers) {
- this.mcQueUsers = mcQueUsers;
- }
- /**
- * @return Returns the session_name.
- */
- public String getSession_name() {
- return session_name;
- }
- /**
- * @param session_name The session_name to set.
- */
- public void setSession_name(String session_name) {
- this.session_name = session_name;
- }
+ /**
+ * @return Returns the sessionEndDate.
+ */
+ public Date getSessionEndDate() {
+ return sessionEndDate;
+ }
+
+ /**
+ * @param sessionEndDate
+ * The sessionEndDate to set.
+ */
+ public void setSessionEndDate(Date sessionEndDate) {
+ this.sessionEndDate = sessionEndDate;
+ }
+
+ /**
+ * @return Returns the sessionStartDate.
+ */
+ public Date getSessionStartDate() {
+ return sessionStartDate;
+ }
+
+ /**
+ * @param sessionStartDate
+ * The sessionStartDate to set.
+ */
+ public void setSessionStartDate(Date sessionStartDate) {
+ this.sessionStartDate = sessionStartDate;
+ }
+
+ /**
+ * @return Returns the sessionStatus.
+ */
+ public String getSessionStatus() {
+ return sessionStatus;
+ }
+
+ /**
+ * @param sessionStatus
+ * The sessionStatus to set.
+ */
+ public void setSessionStatus(String sessionStatus) {
+ this.sessionStatus = sessionStatus;
+ }
+
+ /**
+ * @return Returns the mcQueUsers.
+ */
+
+ public Set getMcQueUsers() {
+ if (this.mcQueUsers == null)
+ setMcQueUsers(new HashSet());
+ return this.mcQueUsers;
+ }
+
+ /**
+ * @param mcQueUsers
+ * The mcQueUsers to set.
+ */
+ public void setMcQueUsers(Set mcQueUsers) {
+ this.mcQueUsers = mcQueUsers;
+ }
+
+ /**
+ * @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;
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/Attic/McUploadedFile.java,v
diff -u -r1.8 -r1.9
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java 8 May 2013 13:03:18 -0000 1.8
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUploadedFile.java 8 May 2013 13:18:26 -0000 1.9
@@ -20,7 +20,7 @@
* http://www.gnu.org/licenses/gpl.txt
* ****************************************************************
*/
-/* $$Id$$ */
+/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.pojos;
import java.io.Serializable;
@@ -29,9 +29,7 @@
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.log4j.Logger;
import org.lamsfoundation.lams.contentrepository.ItemNotFoundException;
-import org.lamsfoundation.lams.contentrepository.NodeKey;
import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler;
@@ -44,183 +42,169 @@
*/
/**
- * McQueContent Value Object
- * The value object that maps to our model database table: tl_lamc11_que_content
- * The relevant hibernate mapping resides in: McQueContent.hbm.xml
- *
- * Holds question content within a particular content
+ * McQueContent Value Object The value object that maps to our model database table: tl_lamc11_que_content The relevant
+ * hibernate mapping resides in: McQueContent.hbm.xml
+ *
+ * Holds question content within a particular content
*/
-public class McUploadedFile implements Serializable, Comparable
-{
- /** identifier field */
+public class McUploadedFile implements Serializable, Comparable {
+ /** identifier field */
private Long submissionId;
-
+
/** persistent field */
private String uuid;
/** persistent field */
private boolean fileOnline;
-
+
/** persistent field */
private String fileName;
-
+
/** persistent field */
private McContent mcContent;
-
- public McUploadedFile(){};
+ public McUploadedFile() {
+ };
+
/** full constructor */
- public McUploadedFile(Long submissionId,
- String uuid,
- boolean fileOnline,
- String fileName,
- McContent mcContent)
- {
- this.submissionId=submissionId;
- this.uuid = uuid;
- this.fileOnline = fileOnline;
- this.fileName = fileName;
- this.mcContent=mcContent;
+ public McUploadedFile(Long submissionId, String uuid, boolean fileOnline, String fileName, McContent mcContent) {
+ this.submissionId = submissionId;
+ this.uuid = uuid;
+ this.fileOnline = fileOnline;
+ this.fileName = fileName;
+ this.mcContent = mcContent;
}
-
-
+
public static McUploadedFile newInstance(IToolContentHandler toolContentHandler, McUploadedFile mcUploadedFile,
- McContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException
-
- {
- McUploadedFile newMcUploadedFile=null;
+ McContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException
- newMcUploadedFile = new McUploadedFile(mcUploadedFile.getUuid(),
- mcUploadedFile.isFileOnline(),
- mcUploadedFile.getFileName(),
- newMcContent);
+ {
+ McUploadedFile newMcUploadedFile = null;
-
- return newMcUploadedFile;
- }
-
-
+ newMcUploadedFile = new McUploadedFile(mcUploadedFile.getUuid(), mcUploadedFile.isFileOnline(),
+ mcUploadedFile.getFileName(), newMcContent);
- public McUploadedFile(String uuid,
- boolean fileOnline,
- String fileName,
- McContent mcContent)
- {
- this.uuid = uuid;
- this.fileOnline = fileOnline;
- this.fileName = fileName;
- this.mcContent=mcContent;
+ return newMcUploadedFile;
}
-
-
+
+ public McUploadedFile(String uuid, boolean fileOnline, String fileName, McContent mcContent) {
+ this.uuid = uuid;
+ this.fileOnline = fileOnline;
+ this.fileName = fileName;
+ this.mcContent = mcContent;
+ }
+
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 McUploadedFile) ) return false;
- McUploadedFile castOther = (McUploadedFile) other;
- return new EqualsBuilder()
- .append(this.getUuid(), castOther.getUuid())
- .isEquals();
+ if (!(other instanceof McUploadedFile))
+ return false;
+ McUploadedFile castOther = (McUploadedFile) 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 mcContent.
- */
- public McContent getMcContent() {
- return mcContent;
- }
- /**
- * @param mcContent The mcContent to set.
- */
- public void setMcContent(McContent mcContent) {
- this.mcContent = mcContent;
- }
- /**
- * @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)
- {
- McUploadedFile file = (McUploadedFile) 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 mcContent.
+ */
+ public McContent getMcContent() {
+ return mcContent;
+ }
+
+ /**
+ * @param mcContent
+ * The mcContent to set.
+ */
+ public void setMcContent(McContent mcContent) {
+ this.mcContent = mcContent;
+ }
+
+ /**
+ * @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) {
+ McUploadedFile file = (McUploadedFile) 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_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java,v
diff -u -r1.7 -r1.8
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java 15 Aug 2007 03:54:49 -0000 1.7
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/pojos/McUsrAttempt.java 8 May 2013 13:18:26 -0000 1.8
@@ -27,11 +27,10 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
- * Persistent object/bean that defines the user attempt for the MCQ tool.
- * Provides accessors and mutators to get/set attributes
- * It maps to database table: tl_lamc11_usr_attempt
+ *
+ * Persistent object/bean that defines the user attempt for the MCQ tool. Provides accessors and mutators to get/set
+ * attributes It maps to database table: tl_lamc11_usr_attempt
*
*
* @author Ozgur Demirtas
@@ -48,17 +47,17 @@
private Date attemptTime;
private Integer mark;
-
+
private boolean finished;
-
+
private boolean attemptCorrect;
-
+
private boolean passed;
-
+
private Integer attemptOrder;
-
+
private Long queUsrId;
-
+
private Long mcQueContentId;
/** persistent field */
@@ -71,222 +70,245 @@
private org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent;
/** full constructor */
- public McUsrAttempt(Long attemptId, Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
- org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
- this.attemptId = attemptId;
- this.attemptTime = attemptTime;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
+ public McUsrAttempt(Long attemptId, Date attemptTime,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
+ this.attemptId = attemptId;
+ this.attemptTime = attemptTime;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
}
- public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
- org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
- this.attemptTime = attemptTime;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
+ public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
+ this.attemptTime = attemptTime;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
}
-
- public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
- org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed) {
- this.attemptTime = attemptTime;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
- this.mark = mark;
- this.passed = passed;
+
+ public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed) {
+ this.attemptTime = attemptTime;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
+ this.mark = mark;
+ this.passed = passed;
}
-
- public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
- org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed, Integer attemptOrder) {
- this.attemptTime = attemptTime;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
- this.mark = mark;
- this.passed = passed;
- this.attemptOrder=attemptOrder;
+
+ public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed,
+ Integer attemptOrder) {
+ this.attemptTime = attemptTime;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
+ this.mark = mark;
+ this.passed = passed;
+ this.attemptOrder = attemptOrder;
}
-
- public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
- org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed, Integer attemptOrder, boolean attemptCorrect) {
- this.attemptTime = attemptTime;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
- this.mark = mark;
- this.passed = passed;
- this.attemptOrder=attemptOrder;
- this.attemptCorrect=attemptCorrect;
+
+ public McUsrAttempt(Date attemptTime, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent, Integer mark, boolean passed,
+ Integer attemptOrder, boolean attemptCorrect) {
+ this.attemptTime = attemptTime;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
+ this.mark = mark;
+ this.passed = passed;
+ this.attemptOrder = attemptOrder;
+ this.attemptCorrect = attemptCorrect;
}
-
-
+
/** default constructor */
public McUsrAttempt() {
}
/** minimal constructor */
- public McUsrAttempt(Long attemptId, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent, org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr, org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
- this.attemptId = attemptId;
- this.mcQueContent = mcQueContent;
- this.mcQueUsr = mcQueUsr;
- this.mcOptionsContent = mcOptionsContent;
+ public McUsrAttempt(Long attemptId, org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent,
+ org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr,
+ org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
+ this.attemptId = attemptId;
+ this.mcQueContent = mcQueContent;
+ this.mcQueUsr = mcQueUsr;
+ this.mcOptionsContent = mcOptionsContent;
}
public Long getUid() {
- return this.uid;
+ return this.uid;
}
public void setUid(Long uid) {
- this.uid = uid;
+ this.uid = uid;
}
public Long getAttemptId() {
- return this.attemptId;
+ return this.attemptId;
}
public void setAttemptId(Long attemptId) {
- this.attemptId = attemptId;
+ this.attemptId = attemptId;
}
public Date getAttemptTime() {
- return this.attemptTime;
+ return this.attemptTime;
}
public void setAttemptTime(Date attemptTime) {
- this.attemptTime = attemptTime;
+ this.attemptTime = attemptTime;
}
public org.lamsfoundation.lams.tool.mc.pojos.McQueContent getMcQueContent() {
- return this.mcQueContent;
+ return this.mcQueContent;
}
public void setMcQueContent(org.lamsfoundation.lams.tool.mc.pojos.McQueContent mcQueContent) {
- this.mcQueContent = mcQueContent;
+ this.mcQueContent = mcQueContent;
}
public org.lamsfoundation.lams.tool.mc.pojos.McQueUsr getMcQueUsr() {
- return this.mcQueUsr;
+ return this.mcQueUsr;
}
public void setMcQueUsr(org.lamsfoundation.lams.tool.mc.pojos.McQueUsr mcQueUsr) {
- this.mcQueUsr = mcQueUsr;
+ this.mcQueUsr = mcQueUsr;
}
public org.lamsfoundation.lams.tool.mc.pojos.McOptsContent getMcOptionsContent() {
- return this.mcOptionsContent;
+ return this.mcOptionsContent;
}
public void setMcOptionsContent(org.lamsfoundation.lams.tool.mc.pojos.McOptsContent mcOptionsContent) {
- this.mcOptionsContent = mcOptionsContent;
+ this.mcOptionsContent = mcOptionsContent;
}
public String toString() {
- return new ToStringBuilder(this)
- .append("uid", getUid())
- .toString();
+ return new ToStringBuilder(this).append("uid", getUid()).toString();
}
- /**
- * @return Returns the mark.
- */
- public Integer getMark() {
- return mark;
- }
- /**
- * @param mark The mark to set.
- */
- public void setMark(Integer mark) {
- this.mark = mark;
- }
- /**
- * @return Returns the passed.
- */
- public boolean isPassed() {
- return passed;
- }
- /**
- * @param passed The passed to set.
- */
- public void setPassed(boolean passed) {
- this.passed = passed;
- }
- /**
- * @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 attemptOrder.
- */
- public Integer getAttemptOrder() {
- return attemptOrder;
- }
- /**
- * @param attemptOrder The attemptOrder to set.
- */
- public void setAttemptOrder(Integer attemptOrder) {
- this.attemptOrder = attemptOrder;
- }
- /**
- * @return Returns the mcQueContentId.
- */
- public Long getMcQueContentId() {
- return mcQueContentId;
- }
- /**
- * @param mcQueContentId The mcQueContentId to set.
- */
- public void setMcQueContentId(Long mcQueContentId) {
- this.mcQueContentId = mcQueContentId;
- }
-
- /**
- * @return Returns the attemptCorrect.
- */
- public boolean isAttemptCorrect() {
- return attemptCorrect;
- }
- /**
- * @param attemptCorrect The attemptCorrect to set.
- */
- public void setAttemptCorrect(boolean attemptCorrect) {
- this.attemptCorrect = attemptCorrect;
- }
-
+ /**
+ * @return Returns the mark.
+ */
+ public Integer getMark() {
+ return mark;
+ }
/**
+ * @param mark
+ * The mark to set.
+ */
+ public void setMark(Integer mark) {
+ this.mark = mark;
+ }
+
+ /**
+ * @return Returns the passed.
+ */
+ public boolean isPassed() {
+ return passed;
+ }
+
+ /**
+ * @param passed
+ * The passed to set.
+ */
+ public void setPassed(boolean passed) {
+ this.passed = passed;
+ }
+
+ /**
+ * @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 attemptOrder.
+ */
+ public Integer getAttemptOrder() {
+ return attemptOrder;
+ }
+
+ /**
+ * @param attemptOrder
+ * The attemptOrder to set.
+ */
+ public void setAttemptOrder(Integer attemptOrder) {
+ this.attemptOrder = attemptOrder;
+ }
+
+ /**
+ * @return Returns the mcQueContentId.
+ */
+ public Long getMcQueContentId() {
+ return mcQueContentId;
+ }
+
+ /**
+ * @param mcQueContentId
+ * The mcQueContentId to set.
+ */
+ public void setMcQueContentId(Long mcQueContentId) {
+ this.mcQueContentId = mcQueContentId;
+ }
+
+ /**
+ * @return Returns the attemptCorrect.
+ */
+ public boolean isAttemptCorrect() {
+ return attemptCorrect;
+ }
+
+ /**
+ * @param attemptCorrect
+ * The attemptCorrect to set.
+ */
+ public void setAttemptCorrect(boolean attemptCorrect) {
+ this.attemptCorrect = attemptCorrect;
+ }
+
+ /**
* @return Returns the finished.
*/
public boolean isFinished() {
- return finished;
+ return finished;
}
+
/**
- * @param finished The finished to set.
+ * @param finished
+ * The finished to set.
*/
public void setFinished(boolean finished) {
- this.finished = finished;
+ this.finished = finished;
}
-
- /** Get the mark for displaying to the user.
- * If retries or passmark is off, then just check whether or not answer is correct
- * If retries and passmark is on, then we only want the marks if the user has passed!
- */
- public Integer getMarkForShow( boolean allowRetries ) {
- if ( isAttemptCorrect() &&
- ( !allowRetries || (allowRetries && isPassed()) ) ) {
- return getMark();
- } else {
- return new Integer(0);
- }
+
+ /**
+ * Get the mark for displaying to the user. If retries or passmark is off, then just check whether or not answer is
+ * correct If retries and passmark is on, then we only want the marks if the user has passed!
+ */
+ public Integer getMarkForShow(boolean allowRetries) {
+ if (isAttemptCorrect() && (!allowRetries || (allowRetries && isPassed()))) {
+ return getMark();
+ } else {
+ return new Integer(0);
}
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java,v
diff -u -r1.66 -r1.67
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 15 Feb 2011 17:17:48 -0000 1.66
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java 8 May 2013 13:18:26 -0000 1.67
@@ -25,8 +25,6 @@
import java.io.InputStream;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-
import org.lamsfoundation.lams.contentrepository.ITicket;
import org.lamsfoundation.lams.contentrepository.NodeKey;
import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
@@ -47,225 +45,229 @@
import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt;
import org.lamsfoundation.lams.usermanagement.User;
-
/**
* @author Ozgur Demirtas
*
- * Interface that defines the contract that all MCQ service provider must follow.
+ * Interface that defines the contract that all MCQ service provider must follow.
*/
-public interface IMcService
-{
- public void configureContentRepository() throws McApplicationException;
-
+public interface IMcService {
+ public void configureContentRepository() throws McApplicationException;
+
public void createMc(McContent mcContent) throws McApplicationException;
-
+
public McContent retrieveMc(Long toolContentId) throws McApplicationException;
-
+
public void createMcQue(McQueContent mcQueContent) throws McApplicationException;
-
+
public void updateMcQueContent(McQueContent mcQueContent) throws McApplicationException;
-
+
public List retrieveMcQueContentsByToolContentId(long mcContentId) throws McApplicationException;
-
- public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid) throws McApplicationException;
-
+
+ public McQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long mcContentUid)
+ throws McApplicationException;
+
public void createMcSession(McSession mcSession) throws McApplicationException;
-
+
public void createMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException;
-
+
public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId) throws McApplicationException;
-
- public McQueUsr retrieveMcQueUsr(Long userId) throws McApplicationException;
-
+
+ public McQueUsr retrieveMcQueUsr(Long userId) throws McApplicationException;
+
public void createMcUsrAttempt(McUsrAttempt mcUsrAttempt) throws McApplicationException;
-
+
public void updateMcUsrAttempt(McUsrAttempt mcUsrAttempt) throws McApplicationException;
-
+
public McQueContent retrieveMcQueContentByUID(Long uid) throws McApplicationException;
-
+
public void removeMcQueContent(McQueContent mcQueContent) throws McApplicationException;
-
+
public McQueContent getMcQueContentByUID(Long uid) throws McApplicationException;
-
+
public void saveOrUpdateMcQueContent(McQueContent mcQueContent) throws McApplicationException;
-
+
public void removeQuestionContentByMcUid(final Long mcContentUid) throws McApplicationException;
-
+
public McOptsContent getMcOptionsContentByUID(Long uid) throws McApplicationException;
-
+
public void cleanAllQuestionsSimple(final Long mcContentUid) throws McApplicationException;
-
+
public void resetAllQuestions(final Long mcContentUid) throws McApplicationException;
-
+
public void cleanAllQuestions(final Long mcContentUid) throws McApplicationException;
-
+
public List refreshQuestionContent(final Long mcContentId) throws McApplicationException;
-
+
public List getAllQuestionEntriesSorted(final long mcContentId) throws McApplicationException;
-
- public List findMcOptionUidsByQueId(Long mcQueContentId) throws McApplicationException;
-
+
+ public List findMcOptionUidsByQueId(Long mcQueContentId) throws McApplicationException;
+
public McQueContent findMcQuestionContentByUid(Long uid) throws McApplicationException;
-
+
public void removeMcOptionsContentByQueId(Long mcQueContentId) throws McApplicationException;
-
+
public void removeMcOptionsContent(McOptsContent mcOptsContent);
-
+
public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid);
-
+
public List getPersistedSelectedOptions(Long mcQueContentId);
-
+
public void removeMcQueContentByUID(Long uid) throws McApplicationException;
-
+
public McQueUsr getMcUserByUID(Long uid) throws McApplicationException;
-
+
public List getCorrectOption(Long mcQueContentId);
-
+
public List getAllQuestionEntries(final Long mcContentId) throws McApplicationException;
-
+
public McSession retrieveMcSession(Long mcSessionId) throws McApplicationException;
-
+
public McContent retrieveMcBySessionId(Long mcSessionId) throws McApplicationException;
-
+
public void updateMc(McContent mc) throws McApplicationException;
-
+
public void updateMcSession(McSession mcSession) throws McApplicationException;
-
+
public void updateMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException;
-
+
public List populateCandidateAnswersDTO(Long mcQueContentId) throws McApplicationException;
-
+
public McSession getMcSessionByUID(Long uid) throws McApplicationException;
-
+
public List getLatestAttemptsForAUser(final Long queUserUid) throws McApplicationException;
-
+
public void deleteMc(McContent mc) throws McApplicationException;
-
+
public void deleteMcById(Long mcId) throws McApplicationException;
-
- public void removeAttempt (McUsrAttempt attempt) throws McApplicationException;
-
+
+ public void removeAttempt(McUsrAttempt attempt) throws McApplicationException;
+
public void deleteMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException;
-
+
public List findMcOptionsContentByQueId(Long mcQueContentId) throws McApplicationException;
-
+
public void saveMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException;
-
+
public McOptsContent getOptionContentByOptionText(final String option, final Long mcQueContentUid);
-
+
public void updateMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException;
-
+
public void deleteMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException;
-
+
public void deleteMcOptionsContentByUID(Long uid) throws McApplicationException;
-
- public User getCurrentUserData(String username) throws McApplicationException;
-
+
+ public User getCurrentUserData(String username) throws McApplicationException;
+
public Lesson getCurrentLesson(long lessonId) throws McApplicationException;
-
+
public void saveMcContent(McContent mc) throws McApplicationException;
-
- public boolean studentActivityOccurredGlobal(McContent mcContent) throws McApplicationException;
-
- /**
- * gets all the attempts for one questions for one user in one tool session queUsrId
,
- * ordered by the attempt id. If there is more than one option selected for a question, the attempts
- * are "batched".
- *
- * @param queUsrId
- * @return
- */
- public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(Long queUsrUid, Long mcQueContentId) throws McApplicationException;
- public List getLatestAttemptsForAUserForOneQuestionContent(Long queUsrUid, Long mcQueContentId) throws McApplicationException;
+ public boolean studentActivityOccurredGlobal(McContent mcContent) throws McApplicationException;
- public int countIncompleteSession(McContent mc) throws McApplicationException;
-
- public boolean studentActivityOccurred(McContent mc) throws McApplicationException;
-
- public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
-
+ /**
+ *
+ * gets all the attempts for one questions for one user in one tool session queUsrId
, ordered by the
+ * attempt id. If there is more than one option selected for a question, the attempts are "batched".
+ *
+ *
+ * @param queUsrId
+ * @return
+ */
+ public List getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(Long queUsrUid,
+ Long mcQueContentId) throws McApplicationException;
+
+ public List getLatestAttemptsForAUserForOneQuestionContent(Long queUsrUid, Long mcQueContentId)
+ throws McApplicationException;
+
+ public int countIncompleteSession(McContent mc) throws McApplicationException;
+
+ public boolean studentActivityOccurred(McContent mc) throws McApplicationException;
+
+ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException;
+
public void setAsForceCompleteSession(Long toolSessionId) throws McApplicationException;
public void setAsForceComplete(Long userId) throws McApplicationException;
-
+
public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException;
-
+
public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException;
- public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException;
-
- public boolean existsSession(Long toolSessionId);
-
+ public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException,
+ ToolException;
+
+ public boolean existsSession(Long toolSessionId);
+
public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException;
-
+
public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException;
- public String leaveToolSession(Long toolSessionId,Long learnerId) throws DataMissingException, ToolException;
+ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException;
public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException;
- public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, ToolException;
-
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException,
+ ToolException;
+
public IToolVO getToolBySignature(String toolSignature) throws McApplicationException;
-
+
public long getToolDefaultContentIdBySignature(String toolSignature) throws McApplicationException;
-
+
public McQueContent getToolDefaultQuestionContent(long contentId) throws McApplicationException;
public ITicket getRepositoryLoginTicket() throws McApplicationException;
-
- public void deleteFromRepository(Long uuid, Long versionID);
-
- public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws McApplicationException;
-
- public InputStream downloadFile(Long uuid, Long versionID) throws McApplicationException;
-
- public void persistFile(String uuid, boolean isOnlineFile, String fileName, McContent mcContent) throws McApplicationException;
-
- public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder) throws McApplicationException;
-
- public McSession findMcSessionById(Long mcSessionId) throws McApplicationException;
-
- public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException;
-
- public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException;
-
+
+ public void deleteFromRepository(Long uuid, Long versionID);
+
+ public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws McApplicationException;
+
+ public InputStream downloadFile(Long uuid, Long versionID) throws McApplicationException;
+
+ public void persistFile(String uuid, boolean isOnlineFile, String fileName, McContent mcContent)
+ throws McApplicationException;
+
+ public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder)
+ throws McApplicationException;
+
+ public McSession findMcSessionById(Long mcSessionId) throws McApplicationException;
+
+ public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException;
+
+ public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType)
+ throws RepositoryCheckedException;
+
public NodeKey copyFile(Long uuid) throws RepositoryCheckedException;
-
+
public List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException;
-
+
public List findMcOptionNamesByQueId(Long mcQueContentId) throws McApplicationException;
-
- public Long createNotebookEntry(Long id, Integer idType, String signature,
- Integer userID, String entry);
-
- public NotebookEntry getEntry(Long id, Integer idType, String signature,
- Integer userID);
-
- public void updateEntry(NotebookEntry notebookEntry);
-
+ public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry);
+
+ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID);
+
+ public void updateEntry(NotebookEntry notebookEntry);
+
public void persistFile(McContent content, McUploadedFile file) throws McApplicationException;
-
+
public void removeFile(Long submissionId) throws McApplicationException;
-
+
public List retrieveMcUploadedFiles(McContent mcContent) throws McApplicationException;
-
+
/**
* Return the top, lowest and average mark for all learners for one particular tool session.
+ *
* @param request
* @return top mark, lowest mark, average mark in that order
*/
public Integer[] getMarkStatistics(McSession mcSession);
-
+
/**
* Returns whether activity is grouped and therefore it is expected more than one tool session.
*
* @param toolContentID
* @return
*/
boolean isGroupedActivity(long toolContentID);
-
-}
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java,v
diff -u -r1.7 -r1.8
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java 8 May 2013 13:03:18 -0000 1.7
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java 8 May 2013 13:18:26 -0000 1.8
@@ -107,8 +107,8 @@
}
/**
- * Get the mark for a specific user. This gets the mark associated with the
- * last attempt. Will always return a ToolOutput object.
+ * Get the mark for a specific user. This gets the mark associated with the last attempt. Will always return a
+ * ToolOutput object.
*/
private ToolOutput getLearnerMark(McQueUsr queUser) {
Long mark;
@@ -122,10 +122,8 @@
}
/**
- * Did the user get the questions all correct. This checks the answers
- * associated with the last attempt. Assumes all correct if the mark is
- * equal to the maximum possible mark. Will always return a ToolOutput
- * object.
+ * Did the user get the questions all correct. This checks the answers associated with the last attempt. Assumes all
+ * correct if the mark is equal to the maximum possible mark. Will always return a ToolOutput object.
*/
private ToolOutput getLearnerAllCorrect(IMcService mcService, McQueUsr queUser) {
boolean allCorrect = allQuestionsCorrect(mcService, queUser);
@@ -137,7 +135,7 @@
// one correct option for a question.
private boolean allQuestionsCorrect(IMcService mcService, McQueUsr queUser) {
- // Build a list of all the correct answers. If we hit any options that are not a correct option
+ // Build a list of all the correct answers. If we hit any options that are not a correct option
// we can abort as we know there is a wrong answer.
// Otherwise count the number of correct options overall (for comparison later).
long correctlearnerOptions = 0;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McImportContentVersionFilter.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McImportContentVersionFilter.java,v
diff -u -r1.7 -r1.8
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McImportContentVersionFilter.java 11 Oct 2007 06:27:31 -0000 1.7
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McImportContentVersionFilter.java 8 May 2013 13:18:26 -0000 1.8
@@ -8,33 +8,34 @@
/**
* Import filter class for different version of MC content.
+ *
* @author steven
- *
+ *
*/
-public class McImportContentVersionFilter extends ToolContentVersionFilter{
+public class McImportContentVersionFilter extends ToolContentVersionFilter {
- /**
- * Import 1.0 version content to 1.1 version tool server.
- *
- */
- public void up10To20061015(){
- this.removeField(McQueContent.class, "weight");
- this.removeField(McUsrAttempt.class, "timeZone");
-
- }
-
- public void up20061015To20061113(){
- // Change name to suit the version you give the tool.
+ /**
+ * Import 1.0 version content to 1.1 version tool server.
+ *
+ */
+ public void up10To20061015() {
+ this.removeField(McQueContent.class, "weight");
+ this.removeField(McUsrAttempt.class, "timeZone");
- this.addField(McContent.class, "showMarks",new Boolean(false));
- this.addField(McContent.class, "randomize",new Boolean(false));
- this.addField(McOptsContent.class, "displayOrder",new Integer(0));
- }
-
- public void up20061113To20070820() {
- // Adds displayAnswers LDEV-1156
-
- this.addField(McContent.class, "displayAnswers", new Boolean(true));
-
- }
+ }
+
+ public void up20061015To20061113() {
+ // Change name to suit the version you give the tool.
+
+ this.addField(McContent.class, "showMarks", new Boolean(false));
+ this.addField(McContent.class, "randomize", new Boolean(false));
+ this.addField(McOptsContent.class, "displayOrder", new Integer(0));
+ }
+
+ public void up20061113To20070820() {
+ // Adds displayAnswers LDEV-1156
+
+ this.addField(McContent.class, "displayAnswers", new Boolean(true));
+
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java,v
diff -u -r1.107 -r1.108
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 8 May 2013 13:03:18 -0000 1.107
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java 8 May 2013 13:18:26 -0000 1.108
@@ -95,8 +95,8 @@
*
* @author Ozgur Demirtas
*
- * The POJO implementation of Mc service. All business logics of MCQ tool are implemented in this class. It translate
- * the request from presentation layer and perform appropriate database operation.
+ * The POJO implementation of Mc service. All business logics of MCQ tool are implemented in this class. It
+ * translate the request from presentation layer and perform appropriate database operation.
*
*/
public class McServicePOJO implements IMcService, ToolContentManager, ToolSessionManager, ToolContentImport102Manager,
@@ -850,7 +850,7 @@
fromContent = mcContentDAO.findMcContentById(fromContentId);
}
-
+
try {
McContent toContent = McContent.newInstance(mcToolContentHandler, fromContent, toContentId);
if (toContent == null) {
@@ -938,7 +938,7 @@
* update the tool session status to COMPLETE for this tool session
*
* @param Long
- * toolSessionId
+ * toolSessionId
*/
public void setAsForceCompleteSession(Long toolSessionId) throws McApplicationException {
McSession mcSession = retrieveMcSession(toolSessionId);
@@ -1016,7 +1016,7 @@
* toolContentId) throws DataMissingException, ToolException
*
* @param toolContentId
- * return
+ * return
* @throws ToolException
*/
public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException {
@@ -1037,9 +1037,9 @@
* 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
+ * if no tool content matches the toolSessionId
* @throws ToolException
- * if any other error occurs
+ * if any other error occurs
*/
public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException {
@@ -1075,7 +1075,7 @@
* Import the XML fragment for the tool's content, along with any files needed for the content.
*
* @throws ToolException
- * if any other error occurs
+ * if any other error occurs
*/
public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion,
String toVersion) throws ToolException {
@@ -1144,13 +1144,13 @@
* group have the same toolSessionId.
*
* @param toolSessionId
- * the generated tool session id.
+ * the generated tool session id.
* @param toolSessionName
- * the tool session name.
+ * the tool session name.
* @param toolContentId
- * the tool content id specified.
+ * the tool content id specified.
* @throws ToolException
- * if an error occurs e.g. defaultContent is missing.
+ * if an error occurs e.g. defaultContent is missing.
*
*/
public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException {
@@ -1214,7 +1214,7 @@
*
* @param toolSessionId
* @param toolContentId
- * return
+ * return
* @throws ToolException
*/
public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException {
@@ -1251,7 +1251,7 @@
*
* @param toolSessionId
* @param learnerId
- * return String
+ * return String
* @throws ToolException
*
*/
@@ -1294,7 +1294,7 @@
* exportToolSession(Long toolSessionId) throws DataMissingException, ToolException
*
* @param toolSessionId
- * return ToolSessionExportOutputData
+ * return ToolSessionExportOutputData
* @throws ToolException
*/
public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException {
@@ -1305,7 +1305,7 @@
* exportToolSession(Long toolSessionId) throws DataMissingException, ToolException
*
* @param toolSessionIds
- * return ToolSessionExportOutputData
+ * return ToolSessionExportOutputData
* @throws ToolException
*/
public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException,
@@ -1401,9 +1401,9 @@
* repository
*
* @param uuid
- * The uuid
of the node to be deleted
+ * The uuid
of the node to be deleted
* @param versionID
- * The version_id
of the node to be deleted.
+ * The version_id
of the node to be deleted.
* @throws SubmitFilesException
*/
public void deleteFromRepository(Long uuid, Long versionID) throws McApplicationException {
@@ -1422,11 +1422,11 @@
* corresponding file is added to the repository.
*
* @param stream
- * The InputStream
representing the data to be added
+ * The InputStream
representing the data to be added
* @param fileName
- * The name of the file being added
+ * The name of the file being added
* @param mimeType
- * The MIME type of the file (eg. TXT, DOC, GIF etc)
+ * The MIME type of the file (eg. TXT, DOC, GIF etc)
* @return NodeKey Represents the two part key - UUID and Version.
* @throws SubmitFilesException
*/
@@ -1467,7 +1467,7 @@
McUploadedFile mcUploadedFile = new McUploadedFile(uuid, isOnlineFile, fileName, mcContent);
mcUploadedFileDAO.saveUploadFile(mcUploadedFile);
}
-
+
public boolean isGroupedActivity(long toolContentID) {
return toolService.isGroupedActivity(toolContentID);
}
@@ -1481,7 +1481,7 @@
/**
* @param cred
- * The cred to set.
+ * The cred to set.
*/
public void setCred(ICredentials cred) {
this.cred = cred;
@@ -1492,7 +1492,6 @@
*
* public void setMcUploadedFileDAO(IMcUploadedFileDAO mcUploadedFileDAO) { this.mcUploadedFileDAO =
* mcUploadedFileDAO; }
- *
*/
/**
@@ -1539,7 +1538,7 @@
/**
* @param mcContentDAO
- * The mcContentDAO to set.
+ * The mcContentDAO to set.
*/
public void setMcContentDAO(IMcContentDAO mcContentDAO) {
this.mcContentDAO = mcContentDAO;
@@ -1554,7 +1553,7 @@
/**
* @param mcOptionsContentDAO
- * The mcOptionsContentDAO to set.
+ * The mcOptionsContentDAO to set.
*/
public void setMcOptionsContentDAO(IMcOptionsContentDAO mcOptionsContentDAO) {
this.mcOptionsContentDAO = mcOptionsContentDAO;
@@ -1569,7 +1568,7 @@
/**
* @param mcQueContentDAO
- * The mcQueContentDAO to set.
+ * The mcQueContentDAO to set.
*/
public void setMcQueContentDAO(IMcQueContentDAO mcQueContentDAO) {
this.mcQueContentDAO = mcQueContentDAO;
@@ -1584,7 +1583,7 @@
/**
* @param mcSessionDAO
- * The mcSessionDAO to set.
+ * The mcSessionDAO to set.
*/
public void setMcSessionDAO(IMcSessionDAO mcSessionDAO) {
this.mcSessionDAO = mcSessionDAO;
@@ -1599,7 +1598,7 @@
/**
* @param mcUserDAO
- * The mcUserDAO to set.
+ * The mcUserDAO to set.
*/
public void setMcUserDAO(IMcUserDAO mcUserDAO) {
this.mcUserDAO = mcUserDAO;
@@ -1614,7 +1613,7 @@
/**
* @param mcUsrAttemptDAO
- * The mcUsrAttemptDAO to set.
+ * The mcUsrAttemptDAO to set.
*/
public void setMcUsrAttemptDAO(IMcUsrAttemptDAO mcUsrAttemptDAO) {
this.mcUsrAttemptDAO = mcUsrAttemptDAO;
@@ -1629,7 +1628,7 @@
/**
* @param repositoryService
- * The repositoryService to set.
+ * The repositoryService to set.
*/
public void setRepositoryService(IRepositoryService repositoryService) {
this.repositoryService = repositoryService;
@@ -1652,7 +1651,7 @@
/**
* @param mcUploadedFileDAO
- * The mcUploadedFileDAO to set.
+ * The mcUploadedFileDAO to set.
*/
public void setMcUploadedFileDAO(IMcUploadedFileDAO mcUploadedFileDAO) {
this.mcUploadedFileDAO = mcUploadedFileDAO;
@@ -1667,7 +1666,7 @@
/**
* @param mcToolContentHandler
- * The mcToolContentHandler to set.
+ * The mcToolContentHandler to set.
*/
public void setMcToolContentHandler(IToolContentHandler mcToolContentHandler) {
this.mcToolContentHandler = mcToolContentHandler;
@@ -1682,7 +1681,7 @@
/**
* @param learnerService
- * The learnerService to set.
+ * The learnerService to set.
*/
public void setLearnerService(ILearnerService learnerService) {
this.learnerService = learnerService;
@@ -1884,7 +1883,7 @@
/**
* @param coreNotebookService
- * The coreNotebookService to set.
+ * The coreNotebookService to set.
*/
public void setCoreNotebookService(ICoreNotebookService coreNotebookService) {
this.coreNotebookService = coreNotebookService;
@@ -1899,7 +1898,7 @@
/**
* @param auditService
- * The auditService to set.
+ * The auditService to set.
*/
public void setAuditService(IAuditService auditService) {
this.auditService = auditService;
@@ -1914,7 +1913,7 @@
/**
* @param messageService
- * The MessageService to set.
+ * The MessageService to set.
*/
public void setMessageService(MessageService messageService) {
this.messageService = messageService;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java,v
diff -u -r1.5 -r1.6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java 15 May 2008 05:40:13 -0000 1.5
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServiceProxy.java 8 May 2013 13:18:26 -0000 1.6
@@ -30,55 +30,47 @@
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
-
-
-
/**
* @author Ozgur Demirtas
- *
- * 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.
+ *
+ *
+ * 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.
+ *
*/
-public class McServiceProxy
-{
+public class McServiceProxy {
/**
- * Return the mc 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
+ * Return the mc 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
* @return mcq service object.
*/
- public static final IMcService getMcService(ServletContext servletContext)
- {
- return (IMcService)getMcDomainService(servletContext);
+ public static final IMcService getMcService(ServletContext servletContext) {
+ return (IMcService) getMcDomainService(servletContext);
}
-
- public static final ToolSessionManager getMcSessionManager(ServletContext servletContext)
- {
- return (ToolSessionManager)getMcDomainService(servletContext);
+
+ public static final ToolSessionManager getMcSessionManager(ServletContext servletContext) {
+ return (ToolSessionManager) getMcDomainService(servletContext);
}
-
- public static final ToolContentManager getMcContentManager(ServletContext servletContext)
- {
- return (ToolContentManager)getMcDomainService(servletContext);
+
+ public static final ToolContentManager getMcContentManager(ServletContext servletContext) {
+ return (ToolContentManager) getMcDomainService(servletContext);
}
-
- public static final MessageService getMessageService(ServletContext servletContext)
- {
- return (MessageService) getMcMessageService(servletContext);
- }
- private static Object getMcDomainService(ServletContext servletContext)
- {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
- return wac.getBean("mcService");
+ public static final MessageService getMessageService(ServletContext servletContext) {
+ return (MessageService) getMcMessageService(servletContext);
}
-
- private static Object getMcMessageService(ServletContext servletContext)
- {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
- return wac.getBean("lamcMessageService");
+
+ private static Object getMcDomainService(ServletContext servletContext) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+ return wac.getBean("mcService");
}
+
+ private static Object getMcMessageService(ServletContext servletContext) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+ return wac.getBean("lamcMessageService");
+ }
}
\ No newline at end of file
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McToolContentHandler.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McToolContentHandler.java,v
diff -u -r1.4 -r1.5
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McToolContentHandler.java 17 Sep 2006 06:23:45 -0000 1.4
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/util/McToolContentHandler.java 8 May 2013 13:18:26 -0000 1.5
@@ -32,35 +32,40 @@
public class McToolContentHandler extends ToolContentHandler {
private static String repositoryWorkspaceName = "lamc11";
- private final String repositoryUser = "lamc11";
- private final char[] repositoryId = {'l','a','m','c','_','1', '1'};
-
+ private final String repositoryUser = "lamc11";
+ private final char[] repositoryId = { 'l', 'a', 'm', 'c', '_', '1', '1' };
/**
*
*/
public McToolContentHandler() {
- super();
+ super();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName()
*/
public String getRepositoryWorkspaceName() {
- return repositoryWorkspaceName;
+ return repositoryWorkspaceName;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser()
*/
public String getRepositoryUser() {
- return repositoryUser;
+ return repositoryUser;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId()
*/
public char[] getRepositoryId() {
- return repositoryId;
+ return repositoryId;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java,v
diff -u -r1.64 -r1.65
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 8 May 2013 13:03:18 -0000 1.64
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java 8 May 2013 13:18:25 -0000 1.65
@@ -109,7 +109,7 @@
public static void cleanupRedundantQuestions(HttpServletRequest request, List existingQuestions,
Map mapQuestionsContent, McContent mcContent, IMcService mcService) {
- /*remove ununsed question entries from the db */
+ /* remove ununsed question entries from the db */
boolean questionFound = false;
Iterator itExistingQuestions = existingQuestions.iterator();
while (itExistingQuestions.hasNext()) {
@@ -128,15 +128,15 @@
if (questionFound == false) {
String deletableQuestion = mcQueContent.getQuestion();
- //found is false, delete this question
+ // found is false, delete this question
mcQueContent = mcService.getQuestionContentByQuestionText(deletableQuestion, mcContent.getUid());
if (mcQueContent != null) {
- //first removing from collection
+ // first removing from collection
mcContent.getMcQueContents().remove(mcQueContent);
mcService.removeMcQueContent(mcQueContent);
- //removed mcQueContent from the db
+ // removed mcQueContent from the db
}
}
}
@@ -392,7 +392,7 @@
if ((!mcQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString()))
&& !mcQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
- //normal cop
+ // normal cop
tempNode.setQuestion(mcQuestionContentDTO.getQuestion());
tempNode.setDisplayOrder(mcQuestionContentDTO.getDisplayOrder());
tempNode.setFeedback(mcQuestionContentDTO.getFeedback());
@@ -401,15 +401,15 @@
tempNode.setMark(mcQuestionContentDTO.getMark());
} else if (mcQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) {
- //move type 1
+ // move type 1
tempNode.setQuestion(replacedNode.getQuestion());
tempNode.setDisplayOrder(replacedNode.getDisplayOrder());
tempNode.setFeedback(replacedNode.getFeedback());
tempNode.setListCandidateAnswersDTO(replacedNode.getListCandidateAnswersDTO());
tempNode.setCaCount(replacedNode.getCaCount());
tempNode.setMark(replacedNode.getMark());
} else if (mcQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
- //move type 2
+ // move type 2
tempNode.setQuestion(mainNode.getQuestion());
tempNode.setDisplayOrder(mainNode.getDisplayOrder());
tempNode.setFeedback(mainNode.getFeedback());
@@ -492,15 +492,15 @@
if ((!new Integer(queIndex).toString().equals(new Integer(intOriginalCandidateIndex).toString()))
&& !new Integer(queIndex).toString().equals(new Integer(replacedNodeIndex).toString())) {
- //normal copy
+ // normal copy
tempNode.setCandidateAnswer(mcCandidateAnswersDTO.getCandidateAnswer());
tempNode.setCorrect(mcCandidateAnswersDTO.getCorrect());
} else if (new Integer(queIndex).toString().equals(new Integer(intOriginalCandidateIndex).toString())) {
- //move type 1
+ // move type 1
tempNode.setCandidateAnswer(replacedNode.getCandidateAnswer());
tempNode.setCorrect(replacedNode.getCorrect());
} else if (new Integer(queIndex).toString().equals(new Integer(replacedNodeIndex).toString())) {
- //move type 2
+ // move type 2
tempNode.setCandidateAnswer(mainNode.getCandidateAnswer());
tempNode.setCorrect(mainNode.getCorrect());
}
@@ -872,7 +872,7 @@
}
if (entryUsed == false) {
- //removing unused entry in db
+ // removing unused entry in db
McQueContent removeableMcQueContent = mcService.getQuestionContentByQuestionText(
queContent.getQuestion(), mcContent.getUid());
@@ -1066,7 +1066,7 @@
if (user != null) {
userId = user.getUserID().longValue();
} else {
- //should not reach here
+ // should not reach here
userId = 0;
}
}
@@ -1099,7 +1099,7 @@
AuthoringUtil.logger.debug("activeModule:" + activeModule);
if (activeModule.equals(McAppConstants.AUTHORING)) {
- //setting other content values
+ // setting other content values
mcContent.setOnlineInstructions(richTextOnlineInstructions);
mcContent.setOfflineInstructions(richTextOfflineInstructions);
mcContent.setQuestionsSequenced(questionsSequencedBoolean);
@@ -1159,7 +1159,7 @@
String currentFeedback = (String) mapFeedback.get(new Integer(displayOrder).toString());
String currentMark = (String) mapMarks.get(new Integer(displayOrder).toString());
- /*set the default mark in case it is not provided*/
+ /* set the default mark in case it is not provided */
if (currentMark == null) {
currentMark = "1";
}
@@ -1169,22 +1169,21 @@
McQueContent queContent = new McQueContent(pairs.getValue().toString(), new Integer(displayOrder),
new Integer(currentMark), currentFeedback, mcContent, null, null);
-
- /* checks if the question is already recorded*/
+ /* checks if the question is already recorded */
McQueContent existingMcQueContent = mcService.getQuestionContentByDisplayOrder(new Long(displayOrder),
mcContent.getUid());
if (existingMcQueContent == null) {
- /*make sure a question with the same question text is not already saved*/
+ /* make sure a question with the same question text is not already saved */
McQueContent duplicateMcQueContent = mcService.getQuestionContentByQuestionText(pairs.getValue()
.toString(), mcContent.getUid());
- //adding a new question to content
+ // adding a new question to content
mcContent.getMcQueContents().add(queContent);
queContent.setMcContent(mcContent);
mcService.createMcQue(queContent);
- //start persisting candidate answers
+ // start persisting candidate answers
persistCandidates(caList, queContent, mcService);
} else {
@@ -1195,12 +1194,12 @@
existingMcQueContent.setDisplayOrder(new Integer(displayOrder));
existingMcQueContent.setMark(new Integer(currentMark));
- //updating the existing question content
+ // updating the existing question content
mcService.updateMcQueContent(existingMcQueContent);
- //will be removing redundant candidates
+ // will be removing redundant candidates
mcService.removeMcOptionsContentByQueId(existingMcQueContent.getUid());
- //start persisting candidates
+ // start persisting candidates
persistCandidates(caList, existingMcQueContent, mcService);
}
@@ -1220,7 +1219,6 @@
intTotalMark = new Integer(totalMark).intValue();
}
-
Map passMarksMap = buildPassMarkMap(intTotalMark, false);
return passMarksMap;
}
@@ -1275,13 +1273,12 @@
String correct = request.getParameter("correct");
- /* check this logic again*/
+ /* check this logic again */
int intCorrect = 0;
if (correct != null) {
intCorrect = new Integer(correct).intValue();
}
-
List listFinalCandidatesDTO = new LinkedList();
for (int i = 0; i < McAppConstants.MAX_OPTION_COUNT; i++) {
@@ -1317,7 +1314,7 @@
String candidate = request.getParameter("ca" + i);
if ((candidate != null) && (candidate.length() == 0)) {
- //there is at least 1 blank candidate
+ // there is at least 1 blank candidate
return false;
}
}
@@ -1341,7 +1338,7 @@
String correct = mcCandidateAnswersDTO.getCorrect();
if (correct.equals("Correct")) {
- //there is at least one Correct candidate, it is good.
+ // there is at least one Correct candidate, it is good.
return true;
}
}
@@ -1360,7 +1357,7 @@
String correct = mcCandidateAnswersDTO.getCorrect();
if (correct.equals("Correct")) {
- //there is at leat one Correct candidate, it is good.
+ // there is at leat one Correct candidate, it is good.
++correctCandidatesCount;
}
}
@@ -1401,7 +1398,6 @@
feedback = mcQueContent.getFeedback();
}
-
String question = mcQueContent.getQuestion();
mcQuestionContentDTO.setQuestion(question);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java,v
diff -u -r1.6 -r1.7
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java 17 Sep 2006 06:23:44 -0000 1.6
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ClearSessionAction.java 8 May 2013 13:18:25 -0000 1.7
@@ -32,73 +32,72 @@
/**
* This class give a chance to clear HttpSession when user save/close authoring page.
- * @author Steve.Ni
- * ----------------XDoclet Tags--------------------
*
- * @struts:action path="/clearsession" validate="false"
- *
+ * @author Steve.Ni ----------------XDoclet Tags--------------------
+ *
+ * @struts:action path="/clearsession" validate="false"
+ *
* @version $Revision$
*/
public class ClearSessionAction extends LamsAuthoringFinishAction {
- public void clearSession(String customiseSessionID,HttpSession session, ToolAccessMode mode) {
- //only this tool save LAMS_AUTHORING_SUCCESS_FLAG into session, remove it!!!
- session.removeAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG);
- if(mode.isAuthor()){
- session.removeAttribute(McAction.SUBMIT_SUCCESS);
- session.removeAttribute(McAction.USER_EXCEPTION_QUESTION_EMPTY);
- session.removeAttribute(McAction.MAX_QUESTION_INDEX);
- session.removeAttribute(McAction.USER_EXCEPTION_WEIGHT_TOTAL);
- session.removeAttribute(McAction.MAP_WEIGHTS);
- session.removeAttribute(McAction.EDIT_OPTIONS_MODE);
- session.removeAttribute(McAction.MAP_GENERAL_OPTIONS_CONTENT);
- session.removeAttribute(McAction.MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
- session.removeAttribute(McAction.MAP_INCORRECT_FEEDBACK);
- session.removeAttribute(McAction.MAP_CORRECT_FEEDBACK);
- session.removeAttribute(McAction.TOOL_CONTENT_ID);
- session.removeAttribute(McAction.SELECTED_QUESTION_INDEX);
- session.removeAttribute(McAction.DEFAULT_QUESTION_UID);
- session.removeAttribute(McAction.USER_EXCEPTION_ANSWERS_DUPLICATE);
- session.removeAttribute(McAction.USER_EXCEPTION_ANSWER_EMPTY);
- session.removeAttribute(McAction.USER_EXCEPTION_NO_TOOL_SESSIONS);
- session.removeAttribute(McAction.LIST_UPLOADED_OFFLINE_FILENAMES);
- session.removeAttribute(McAction.LIST_UPLOADED_ONLINE_FILENAMES);
- session.removeAttribute(McAction.CREATION_DATE);
- session.removeAttribute(McAction.LIST_OFFLINEFILES_METADATA);
- session.removeAttribute(McAction.LIST_ONLINEFILES_METADATA);
- session.removeAttribute(McAction.QUESTIONS_WITHNO_OPTIONS);
- session.removeAttribute(McAction.RICHTEXT_CORRECT_FEEDBACK);
- //session.removeAttribute(McAction.RICHTEXT_END_LEARNING_MSG);
- session.removeAttribute(McAction.RICHTEXT_OFFLINEINSTRUCTIONS);
- session.removeAttribute(McAction.RICHTEXT_ONLINEINSTRUCTIONS);
- session.removeAttribute(McAction.RICHTEXT_INSTRUCTIONS);
- session.removeAttribute(McAction.MAP_STARTUP_GENERAL_OPTIONS_CONTENT);
- session.removeAttribute(McAction.MAP_STARTUP_GENERAL_OPTIONS_QUEID);
- session.removeAttribute(McAction.MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
- session.removeAttribute(McAction.SHOW_AUTHORING_TABS);
- session.removeAttribute(McAction.MAP_SELECTED_OPTIONS);
- session.removeAttribute(McAction.SELECTED_QUESTION);
- session.removeAttribute(McAction.DEFINE_LATER_IN_EDIT_MODE);
- session.removeAttribute(McAction.RICHTEXT_TITLE);
- session.removeAttribute(McAction.RICHTEXT_REPORT_TITLE);
- session.removeAttribute(McAction.DEFAULT_CONTENT_ID);
- session.removeAttribute(McAction.DEFINE_LATER);
- session.removeAttribute(McAction.MAP_DISABLED_QUESTIONS);
- session.removeAttribute(McAction.MAP_QUESTIONS_CONTENT);
- session.removeAttribute(McAction.IS_REVISITING_USER);
- session.removeAttribute(McAction.MAP_CHECKBOX_STATES);
- session.removeAttribute(McAction.ACTIVE_MODULE);
- session.removeAttribute("queIndex");
- session.removeAttribute(McAction.MAP_OPTIONS_CONTENT);
- session.removeAttribute(McAction.MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
- session.removeAttribute(McAction.PASSMARK);
- session.removeAttribute(McAction.TOOL_SERVICE);
- session.removeAttribute(McAction.MAP_DEFAULTOPTIONS_CONTENT);
- session.removeAttribute(McAction.RETRIES);
- session.removeAttribute(McAction.DEFINE_LATER_EDIT_ACTIVITY);
- session.removeAttribute("optionIndex");
- }
+ public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) {
+ // only this tool save LAMS_AUTHORING_SUCCESS_FLAG into session, remove it!!!
+ session.removeAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG);
+ if (mode.isAuthor()) {
+ session.removeAttribute(McAction.SUBMIT_SUCCESS);
+ session.removeAttribute(McAction.USER_EXCEPTION_QUESTION_EMPTY);
+ session.removeAttribute(McAction.MAX_QUESTION_INDEX);
+ session.removeAttribute(McAction.USER_EXCEPTION_WEIGHT_TOTAL);
+ session.removeAttribute(McAction.MAP_WEIGHTS);
+ session.removeAttribute(McAction.EDIT_OPTIONS_MODE);
+ session.removeAttribute(McAction.MAP_GENERAL_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.MAP_GENERAL_SELECTED_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.MAP_INCORRECT_FEEDBACK);
+ session.removeAttribute(McAction.MAP_CORRECT_FEEDBACK);
+ session.removeAttribute(McAction.TOOL_CONTENT_ID);
+ session.removeAttribute(McAction.SELECTED_QUESTION_INDEX);
+ session.removeAttribute(McAction.DEFAULT_QUESTION_UID);
+ session.removeAttribute(McAction.USER_EXCEPTION_ANSWERS_DUPLICATE);
+ session.removeAttribute(McAction.USER_EXCEPTION_ANSWER_EMPTY);
+ session.removeAttribute(McAction.USER_EXCEPTION_NO_TOOL_SESSIONS);
+ session.removeAttribute(McAction.LIST_UPLOADED_OFFLINE_FILENAMES);
+ session.removeAttribute(McAction.LIST_UPLOADED_ONLINE_FILENAMES);
+ session.removeAttribute(McAction.CREATION_DATE);
+ session.removeAttribute(McAction.LIST_OFFLINEFILES_METADATA);
+ session.removeAttribute(McAction.LIST_ONLINEFILES_METADATA);
+ session.removeAttribute(McAction.QUESTIONS_WITHNO_OPTIONS);
+ session.removeAttribute(McAction.RICHTEXT_CORRECT_FEEDBACK);
+ // session.removeAttribute(McAction.RICHTEXT_END_LEARNING_MSG);
+ session.removeAttribute(McAction.RICHTEXT_OFFLINEINSTRUCTIONS);
+ session.removeAttribute(McAction.RICHTEXT_ONLINEINSTRUCTIONS);
+ session.removeAttribute(McAction.RICHTEXT_INSTRUCTIONS);
+ session.removeAttribute(McAction.MAP_STARTUP_GENERAL_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.MAP_STARTUP_GENERAL_OPTIONS_QUEID);
+ session.removeAttribute(McAction.MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.SHOW_AUTHORING_TABS);
+ session.removeAttribute(McAction.MAP_SELECTED_OPTIONS);
+ session.removeAttribute(McAction.SELECTED_QUESTION);
+ session.removeAttribute(McAction.DEFINE_LATER_IN_EDIT_MODE);
+ session.removeAttribute(McAction.RICHTEXT_TITLE);
+ session.removeAttribute(McAction.RICHTEXT_REPORT_TITLE);
+ session.removeAttribute(McAction.DEFAULT_CONTENT_ID);
+ session.removeAttribute(McAction.DEFINE_LATER);
+ session.removeAttribute(McAction.MAP_DISABLED_QUESTIONS);
+ session.removeAttribute(McAction.MAP_QUESTIONS_CONTENT);
+ session.removeAttribute(McAction.IS_REVISITING_USER);
+ session.removeAttribute(McAction.MAP_CHECKBOX_STATES);
+ session.removeAttribute(McAction.ACTIVE_MODULE);
+ session.removeAttribute("queIndex");
+ session.removeAttribute(McAction.MAP_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT);
+ session.removeAttribute(McAction.PASSMARK);
+ session.removeAttribute(McAction.TOOL_SERVICE);
+ session.removeAttribute(McAction.MAP_DEFAULTOPTIONS_CONTENT);
+ session.removeAttribute(McAction.RETRIES);
+ session.removeAttribute(McAction.DEFINE_LATER_EDIT_ACTIVITY);
+ session.removeAttribute("optionIndex");
}
+ }
-
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java,v
diff -u -r1.19 -r1.20
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java 8 May 2013 13:03:18 -0000 1.19
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/ExportServlet.java 8 May 2013 13:18:25 -0000 1.20
@@ -21,7 +21,6 @@
* ****************************************************************
*/
-
package org.lamsfoundation.lams.tool.mc.web;
import java.io.File;
@@ -47,193 +46,189 @@
import org.lamsfoundation.lams.tool.mc.service.McServiceProxy;
import org.lamsfoundation.lams.util.MessageService;
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 McAppConstants{
+public class ExportServlet extends AbstractExportPortfolioServlet implements McAppConstants {
static Logger logger = Logger.getLogger(ExportServlet.class.getName());
- private static final long serialVersionUID = -17790L;
- private final String FILENAME = "mcq_main.html";
-
-
- public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
- {
- String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
+ private static final long serialVersionUID = -17790L;
+ private final String FILENAME = "mcq_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) {
+ String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ + request.getContextPath();
- 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 {
- IMcService mcService = McServiceProxy.getMcService(getServletContext());
- McContent content = null;
- if ( toolContentID != null ) {
- content=mcService.retrieveMc(toolContentID);
- } else {
- McSession session=mcService.retrieveMcSession(toolSessionID);
- if ( session != null )
- content = session.getMcContent();
- }
- if ( content != null ) {
- activityTitle = content.getTitle();
- }
- }
- return super.doOfflineExport(request, response, directoryName, cookies);
- }
- /**
- * learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
- *
- * generates report for learner mode
- *
- * @param request
- * @param response
- * @param directoryName
- * @param cookies
- */
- public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] 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 {
IMcService mcService = McServiceProxy.getMcService(getServletContext());
-
- if (userID == null || toolSessionID == null)
- {
- String error = "Tool session Id or user Id is null. Unable to continue";
- logger.error(error);
- throw new McApplicationException(error);
- }
-
- McSession mcSession=mcService.retrieveMcSession(toolSessionID);
-
- // If the learner hasn't selected any options 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
- McQueUsr learner = mcService.getMcUserBySession(userID,mcSession.getUid());
-
- McContent content=mcSession.getMcContent();
-
- if (content == null)
- {
- String error="The content for this activity has not been defined yet.";
- logger.error(error);
- throw new McApplicationException(error);
- }
+ McContent content = null;
+ if (toolContentID != null) {
+ content = mcService.retrieveMc(toolContentID);
+ } else {
+ McSession session = mcService.retrieveMcSession(toolSessionID);
+ if (session != null)
+ content = session.getMcContent();
+ }
+ if (content != null) {
+ activityTitle = content.getTitle();
+ }
+ }
+ return super.doOfflineExport(request, response, directoryName, cookies);
+ }
- request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "learner");
+ /**
+ * learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
+ *
+ * generates report for learner mode
+ *
+ * @param request
+ * @param response
+ * @param directoryName
+ * @param cookies
+ */
+ public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) {
- if ( learner != null ) {
- McMonitoringAction mcMonitoringAction= new McMonitoringAction();
- List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionDataForExportLearner(request, content, mcService, mcSession, learner );
- request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO);
-
- request.getSession().setAttribute(LEARNER_MARK,learner.getLastAttemptTotalMark());
- request.getSession().setAttribute(LEARNER_NAME,learner.getFullname() );
+ IMcService mcService = McServiceProxy.getMcService(getServletContext());
- request.getSession().setAttribute(PASSMARK,content.getPassMark().toString());
- mcMonitoringAction.prepareReflectionData(request, content, mcService, userID.toString(), true);
- }
-
- }
+ if (userID == null || toolSessionID == null) {
+ String error = "Tool session Id or user Id is null. Unable to continue";
+ logger.error(error);
+ throw new McApplicationException(error);
+ }
-
- /**
- * teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
- *
- * generates report for teacher mode
- * @param request
- * @param response
- * @param directoryName
- * @param cookies
- */
- public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
- {
-
- IMcService mcService = McServiceProxy.getMcService(getServletContext());
-
- if (toolContentID==null)
- {
- String error="Tool Content Id is missing. Unable to continue";
- logger.error(error);
- throw new McApplicationException(error);
- }
+ McSession mcSession = mcService.retrieveMcSession(toolSessionID);
- McContent content=mcService.retrieveMc(toolContentID);
-
- if (content == null)
- {
- String error="Data is missing from the database. Unable to Continue";
- logger.error(error);
- throw new McApplicationException(error);
- }
-
- McMonitoringAction mcMonitoringAction= new McMonitoringAction();
+ // If the learner hasn't selected any options 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
+ McQueUsr learner = mcService.getMcUserBySession(userID, mcSession.getUid());
- List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionData(request, content, mcService);
+ McContent content = mcSession.getMcContent();
+
+ if (content == null) {
+ String error = "The content for this activity has not been defined yet.";
+ logger.error(error);
+ throw new McApplicationException(error);
+ }
+
+ request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "learner");
+
+ if (learner != null) {
+ McMonitoringAction mcMonitoringAction = new McMonitoringAction();
+ List listMonitoredAnswersContainerDTO = MonitoringUtil.buildGroupsQuestionDataForExportLearner(request,
+ content, mcService, mcSession, learner);
request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO);
-
-
- List listMonitoredMarksContainerDTO=MonitoringUtil.buildGroupsMarkData(request, content, mcService);
- request.getSession().setAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO, listMonitoredMarksContainerDTO);
- request.getSession().setAttribute(PASSMARK,content.getPassMark().toString());
- request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "teacher");
-
- mcMonitoringAction.prepareReflectionData(request, content, mcService, null, true);
-
- writeOutSessionData(request, response, content, mcService, directoryName);
+ request.getSession().setAttribute(LEARNER_MARK, learner.getLastAttemptTotalMark());
+ request.getSession().setAttribute(LEARNER_NAME, learner.getFullname());
+
+ request.getSession().setAttribute(PASSMARK, content.getPassMark().toString());
+ mcMonitoringAction.prepareReflectionData(request, content, mcService, userID.toString(), true);
+ }
+
}
-
+
/**
+ * teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies)
+ *
+ * generates report for teacher mode
+ *
+ * @param request
+ * @param response
+ * @param directoryName
+ * @param cookies
+ */
+ public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) {
+
+ IMcService mcService = McServiceProxy.getMcService(getServletContext());
+
+ if (toolContentID == null) {
+ String error = "Tool Content Id is missing. Unable to continue";
+ logger.error(error);
+ throw new McApplicationException(error);
+ }
+
+ McContent content = mcService.retrieveMc(toolContentID);
+
+ if (content == null) {
+ String error = "Data is missing from the database. Unable to Continue";
+ logger.error(error);
+ throw new McApplicationException(error);
+ }
+
+ McMonitoringAction mcMonitoringAction = new McMonitoringAction();
+
+ List listMonitoredAnswersContainerDTO = MonitoringUtil.buildGroupsQuestionData(request, content, mcService);
+ request.getSession().setAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO, listMonitoredAnswersContainerDTO);
+
+ List listMonitoredMarksContainerDTO = MonitoringUtil.buildGroupsMarkData(request, content, mcService);
+ request.getSession().setAttribute(LIST_MONITORED_MARKS_CONTAINER_DTO, listMonitoredMarksContainerDTO);
+
+ request.getSession().setAttribute(PASSMARK, content.getPassMark().toString());
+ request.getSession().setAttribute(PORTFOLIO_EXPORT_MODE, "teacher");
+
+ mcMonitoringAction.prepareReflectionData(request, content, mcService, null, true);
+
+ writeOutSessionData(request, response, content, mcService, directoryName);
+ }
+
+ /**
* creates create spreadsheet of class data
+ *
* @param request
* @param response
* @param directoryName
*/
- public void writeOutSessionData(HttpServletRequest request, HttpServletResponse response, McContent mcContent, IMcService mcService, String directoryName) {
- String fileName="lams_mcq_All_" + toolContentID + ".xls";
- MessageService messageService = McServiceProxy.getMessageService(getServletContext());
-
- OutputStream out = null;
- try{
- out = new FileOutputStream(directoryName + File.separator + fileName);
-
- McMonitoringAction mcMonitoringAction= new McMonitoringAction();
- byte[] spreadsheet = mcMonitoringAction.prepareSessionDataSpreadsheet(request, response, mcContent, mcService, messageService, "All");
+ public void writeOutSessionData(HttpServletRequest request, HttpServletResponse response, McContent mcContent,
+ IMcService mcService, String directoryName) {
+ String fileName = "lams_mcq_All_" + toolContentID + ".xls";
+ MessageService messageService = McServiceProxy.getMessageService(getServletContext());
- out.write(spreadsheet);
-
- request.getSession().setAttribute(PORTFOLIO_EXPORT_DATA_FILENAME, fileName);
- }
- catch(FileNotFoundException e)
- {
- logger.error("Exception creating spreadsheet: ",e) ;
- }
- catch(IOException e)
- {
- logger.error("exception creating spreadsheet: ",e) ;
- }
- catch(Exception e)
- {
- logger.error("exception creating spreadsheet: ",e) ;
- }
- finally
- {
- try {
- if (out != null) out.close();
- } catch (IOException e) {}
- }
-
+ OutputStream out = null;
+ try {
+ out = new FileOutputStream(directoryName + File.separator + fileName);
+
+ McMonitoringAction mcMonitoringAction = new McMonitoringAction();
+ byte[] spreadsheet = mcMonitoringAction.prepareSessionDataSpreadsheet(request, response, mcContent,
+ mcService, messageService, "All");
+
+ out.write(spreadsheet);
+
+ request.getSession().setAttribute(PORTFOLIO_EXPORT_DATA_FILENAME, fileName);
+ } catch (FileNotFoundException e) {
+ logger.error("Exception creating spreadsheet: ", e);
+ } catch (IOException e) {
+ logger.error("exception creating spreadsheet: ", e);
+ } catch (Exception e) {
+ logger.error("exception creating spreadsheet: ", e);
+ } finally {
+ try {
+ if (out != null)
+ out.close();
+ } catch (IOException e) {
+ }
+ }
+
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v
diff -u -r1.52 -r1.53
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 8 May 2013 13:03:18 -0000 1.52
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 8 May 2013 13:18:25 -0000 1.53
@@ -170,8 +170,8 @@
McQueContent mcQueContent = mcService.findMcQuestionContentByUid(mcLearnerAnswersDTO.getQuestionUid());
createIndividualOptions(request, mcLearnerAnswersDTO.getCandidateAnswers(), mcQueContent, mcQueUsr,
- attemptTime, mcLearnerAnswersDTO.getMark(), passed, highestAttemptOrder, mcLearnerAnswersDTO
- .getAttemptCorrect(), mcService);
+ attemptTime, mcLearnerAnswersDTO.getMark(), passed, highestAttemptOrder,
+ mcLearnerAnswersDTO.getAttemptCorrect(), mcService);
}
}
@@ -207,10 +207,10 @@
.toString(), mcQueContent.getUid());
if (mcOptsContent != null) {
McUsrAttempt mcUsrAttempt = new McUsrAttempt(attemptTime, mcQueContent, mcQueUsr,
- mcOptsContent, IntegerMark, passed, highestAttemptOrder, new Boolean(isAttemptCorrect)
- .booleanValue());
+ mcOptsContent, IntegerMark, passed, highestAttemptOrder,
+ new Boolean(isAttemptCorrect).booleanValue());
mcService.createMcUsrAttempt(mcUsrAttempt);
- //created mcUsrAttempt in the db
+ // created mcUsrAttempt in the db
}
}
}
@@ -287,13 +287,13 @@
String caUid = (String) listCandidateAnswerUids.get(randomInt);
if (!isEntryStored(ca, randomList)) {
- //adding ca, since it is a new candidate
+ // adding ca, since it is a new candidate
randomList.add(ca);
randomUidList.add(caUid);
LearningUtil.logger.debug("randomList size: " + randomList.size());
if (randomList.size() == listCandidateAnswers.size()) {
- //the list is populated completely
+ // the list is populated completely
listNotComplete = false;
}
}
@@ -315,7 +315,7 @@
String caStored = (String) randomListIterator.next();
if (caStored.equals(ca)) {
- //this ca already is stored
+ // this ca already is stored
return true;
}
}
@@ -438,8 +438,8 @@
Integer mark = null;
if (mcUsrAttemptFinal != null) {
- mapFinalAnswersIsContent.put(questionDisplayOrderString, new Boolean(mcUsrAttemptFinal
- .isAttemptCorrect()).toString());
+ mapFinalAnswersIsContent.put(questionDisplayOrderString,
+ new Boolean(mcUsrAttemptFinal.isAttemptCorrect()).toString());
mapFinalAnswersContent.put(questionDisplayOrderString, mcUsrAttemptFinal.getMcOptionsContent()
.getMcQueOptionText().toString());
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v
diff -u -r1.135 -r1.136
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 8 May 2013 13:03:17 -0000 1.135
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 8 May 2013 13:18:25 -0000 1.136
@@ -56,7 +56,6 @@
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.mc.EditActivityDTO;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
-import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO;
@@ -211,7 +210,7 @@
request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- //there are no issues with input, continue and submit data
+ // there are no issues with input, continue and submit data
McContent mcContentTest = mcService.retrieveMc(new Long(strToolContentID));
@@ -224,13 +223,13 @@
if (errors.isEmpty()) {
authoringUtil.removeRedundantQuestions(mapQuestionContent, mcService, mcAuthoringForm, request,
strToolContentID);
- //end of removing unused entries
+ // end of removing unused entries
mcContent = authoringUtil.saveOrUpdateMcContent(mapQuestionContent, mapFeedback, mapWeights, mapMarks,
mapCandidatesList, mcService, mcAuthoringForm, request, mcContentTest, strToolContentID);
long defaultContentID = 0;
- //attempt retrieving tool with signatute McAppConstants.MY_SIGNATURE
+ // attempt retrieving tool with signatute McAppConstants.MY_SIGNATURE
defaultContentID = mcService.getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE);
if (mcContent != null) {
@@ -249,22 +248,22 @@
}
McUtils.setDefineLater(request, false, strToolContentID, mcService);
- //define later set to false
+ // define later set to false
McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
defaultContentIdStr, activeModule, sessionMap, httpSessionID);
if (activeModule.equals(McAppConstants.AUTHORING)) {
- //standard authoring close
+ // standard authoring close
request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
} else {
- //go back to view only screen
+ // go back to view only screen
mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
}
} else {
- //errors is not empty
+ // errors is not empty
if (mcContent != null) {
long defaultContentID = 0;
@@ -297,7 +296,7 @@
request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- //generating dyn pass map using listQuestionContentDTO
+ // generating dyn pass map using listQuestionContentDTO
Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
@@ -406,7 +405,7 @@
if ((newQuestion != null) && (newQuestion.length() > 0)) {
if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false"))) {
- //request for add and save
+ // request for add and save
boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
if (!duplicates) {
@@ -437,12 +436,12 @@
listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(
listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex);
- //post reorderUpdateListQuestionContentDTO listQuestionContentDTO
+ // post reorderUpdateListQuestionContentDTO listQuestionContentDTO
} else {
- //duplicate question entry, not adding
+ // duplicate question entry, not adding
}
} else {
- //request for edit and save
+ // request for edit and save
McQuestionContentDTO mcQuestionContentDTO = null;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
@@ -472,7 +471,7 @@
mcQuestionContentDTO, editableQuestionIndex);
}
} else {
- //entry blank, not adding
+ // entry blank, not adding
}
mcGeneralAuthoringDTO.setMarkValue(mark);
@@ -487,12 +486,12 @@
return (mapping.findForward(McAppConstants.LOAD_QUESTIONS));
} else {
- //errors is not empty
+ // errors is not empty
commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
- //generating dyn pass map using listQuestionContentDTO
+ // generating dyn pass map using listQuestionContentDTO
Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
@@ -804,13 +803,13 @@
listQuestionContentDTO.add(mcQuestionContentDTO);
} else {
- //entry duplicate, not adding
+ // entry duplicate, not adding
}
} else {
- //entry blank, not adding
+ // entry blank, not adding
}
} else {
- //errors, not adding
+ // errors, not adding
commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
@@ -889,7 +888,7 @@
String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE))
.toString();
- /* create default mcContent object*/
+ /* create default mcContent object */
McContent mcContent = mcService.retrieveMc(new Long(defaultContentIdStr));
McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
@@ -930,7 +929,7 @@
List listAddableQuestionContentDTO = (List) sessionMap.get(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY);
if ((requestType != null) && (requestType.equals("direct"))) {
- //requestType is direct
+ // requestType is direct
listAddableQuestionContentDTO = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
}
@@ -1376,7 +1375,7 @@
return (mapping.findForward(McAppConstants.LOAD_QUESTIONS));
}
- public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
@@ -1685,8 +1684,10 @@
deletedAttachmentList = new ArrayList();
}
- /* move the file's details from the attachment collection to the deleted attachments collection
- the attachment will be delete on saving. */
+ /*
+ * move the file's details from the attachment collection to the deleted attachments collection the attachment
+ * will be delete on saving.
+ */
deletedAttachmentList = McUtils.moveToDelete(Long.toString(uuid), attachmentList, deletedAttachmentList);
@@ -1766,17 +1767,17 @@
boolean isOnlineFile = false;
String fileType = null;
if ((mcAuthoringForm.getTheOfflineFile() != null) && (mcAuthoringForm.getTheOfflineFile().getFileSize() > 0)) {
- //theOfflineFile is available
+ // theOfflineFile is available
uploadedFile = mcAuthoringForm.getTheOfflineFile();
fileType = IToolContentHandler.TYPE_OFFLINE;
} else if ((mcAuthoringForm.getTheOnlineFile() != null)
&& (mcAuthoringForm.getTheOnlineFile().getFileSize() > 0)) {
- //theOnlineFile is available
+ // theOnlineFile is available
uploadedFile = mcAuthoringForm.getTheOnlineFile();
isOnlineFile = true;
fileType = IToolContentHandler.TYPE_ONLINE;
} else {
- /*no file uploaded*/
+ /* no file uploaded */
return;
}
@@ -1793,8 +1794,9 @@
deletedAttachmentList);
try {
- /* This is a new file and so is saved to the content repository. Add it to the
- attachments collection, but don't add it to the tool's tables yet.
+ /*
+ * This is a new file and so is saved to the content repository. Add it to the attachments collection, but
+ * don't add it to the tool's tables yet.
*/
NodeKey node = getToolContentHandler().uploadFile(uploadedFile.getInputStream(),
uploadedFile.getFileName(), uploadedFile.getContentType(), fileType);
@@ -1940,7 +1942,7 @@
sessionMap.put(McAppConstants.ACTIVITY_TITLE_KEY, mcContent.getTitle());
sessionMap.put(McAppConstants.ACTIVITY_INSTRUCTIONS_KEY, mcContent.getInstructions());
- /* determine whether the request is from Monitoring url Edit Activity*/
+ /* determine whether the request is from Monitoring url Edit Activity */
String sourceMcStarter = (String) request.getAttribute(McAppConstants.SOURCE_MC_STARTER);
mcAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString());
@@ -1950,7 +1952,7 @@
mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(false).toString());
if (isContentInUse == true) {
- //monitoring url does not allow editActivity since the content is in use
+ // monitoring url does not allow editActivity since the content is in use
persistError(request, "error.content.inUse");
mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString());
}
@@ -2065,8 +2067,8 @@
editableQuestion = mcQuestionContentDTO.getQuestion();
candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
- //candidates found
- //but we are using the repopulated caList here
+ // candidates found
+ // but we are using the repopulated caList here
listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down");
@@ -2848,7 +2850,7 @@
List listCandidates = new LinkedList();
Iterator listIterator = listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
+ /* there is only 1 question dto */
while (listIterator.hasNext()) {
McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
@@ -3004,7 +3006,7 @@
List listCandidates = new LinkedList();
Iterator listIterator = listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
+ /* there is only 1 question dto */
while (listIterator.hasNext()) {
McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
@@ -3144,7 +3146,7 @@
List listCandidates = new LinkedList();
Iterator listIterator = listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
+ /* there is only 1 question dto */
while (listIterator.hasNext()) {
McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
@@ -3319,7 +3321,7 @@
List listCandidates = new LinkedList();
Iterator listIterator = listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
+ /* there is only 1 question dto */
while (listIterator.hasNext()) {
McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java,v
diff -u -r1.43 -r1.44
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java 11 Oct 2007 06:27:32 -0000 1.43
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAuthoringForm.java 8 May 2013 13:18:25 -0000 1.44
@@ -27,1021 +27,1200 @@
/**
* @author Ozgur Demirtas
- *
- * ActionForm for the Authoring environment
+ *
+ * ActionForm for the Authoring environment
*/
public class McAuthoringForm extends McLearningForm implements McAppConstants {
- /* form controllers */
- protected String addOptionContent;
- protected String currentTab;
-
- protected String questionIndex;
- protected String optionIndex;
- protected String selectedIndex;
- protected String deletableOptionIndex;
-
- protected String editDefaultQuestion;
- protected String removeOptionContent;
-
- protected String activeModule;
- protected String editOptionsMode;
-
- protected String showMarks;
- protected String randomize;
- protected String displayAnswers;
-
- protected String fileItem;
- protected String uuid;
-
- protected FormFile receivedFile;
- protected String offlineFile;
- protected String defaultContentIdStr;
-
- protected String addContent;
- protected String removeContent;
- protected String removeAllContent;
- protected String submitAllContent;
- protected String submitTabDone;
- protected String submitOfflineFile;
- protected String submitOnlineFile;
-
- // dispatch controls which method is called by the Lookup map */
- protected String dispatch;
-
- /* tab controller, these may go away once the Flash wraps the jsp */
- protected String choice;
- protected String choiceBasic;
- protected String choiceAdvanced;
- protected String choiceInstructions;
-
- protected String submit;
-
- /* basic content */
- protected String title;
- protected String instructions;
-
- protected String isRemoveContent;
- protected String toolContentId;
- protected String toolContentID;
-
- /* instructions content */
- protected String onlineInstructions;
- protected String offlineInstructions;
- protected FormFile theOfflineFile;
- protected FormFile theOnlineFile;
-
- protected String richTextOfflineInstructions;
- protected String richTextOnlineInstructions;
-
- /* advanced content */
- protected String synchInMonitor;
- protected String showFeedback;
- protected String retries;
- protected String sln;
-
- protected String passmark;
-
- protected String reportTitle;
- protected String monitoringReportTitle;
- protected String endLearningMessage;
- protected String usernameVisible;
- protected String questionsSequenced;
-
- 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 clickedObj;
+ /* form controllers */
+ protected String addOptionContent;
+ protected String currentTab;
- protected String edit;
- private String contentFolderID;
- private String editableQuestionIndex;
- private String defineLaterInEditMode;
- private String feedback;
- private String candidateIndex;
- private String totalMarks;
- protected String currentField;
-
- public void resetUserAction()
- {
- this.editDefaultQuestion=null;
- this.addOptionContent=null;
- this.removeOptionContent=null;
-
- this.fileItem=null;
-
- this.addContent=null;
- this.removeContent=null;
- this.removeAllContent=null;
- this.submitAllContent=null;
- this.submitTabDone=null;
- this.submitOfflineFile=null;
- this.submitOnlineFile=null;
-
- this.dispatch=null;
-
- this.summaryMonitoring=null;
- this.instructionsMonitoring=null;
- this.editActivityMonitoring=null;
- this.statsMonitoring=null;
- this.edit=null;
- this.submit=null;
+ protected String questionIndex;
+ protected String optionIndex;
+ protected String selectedIndex;
+ protected String deletableOptionIndex;
+
+ protected String editDefaultQuestion;
+ protected String removeOptionContent;
+
+ protected String activeModule;
+ protected String editOptionsMode;
+
+ protected String showMarks;
+ protected String randomize;
+ protected String displayAnswers;
+
+ protected String fileItem;
+ protected String uuid;
+
+ protected FormFile receivedFile;
+ protected String offlineFile;
+ protected String defaultContentIdStr;
+
+ protected String addContent;
+ protected String removeContent;
+ protected String removeAllContent;
+ protected String submitAllContent;
+ protected String submitTabDone;
+ protected String submitOfflineFile;
+ protected String submitOnlineFile;
+
+ // dispatch controls which method is called by the Lookup map */
+ protected String dispatch;
+
+ /* tab controller, these may go away once the Flash wraps the jsp */
+ protected String choice;
+ protected String choiceBasic;
+ protected String choiceAdvanced;
+ protected String choiceInstructions;
+
+ protected String submit;
+
+ /* basic content */
+ protected String title;
+ protected String instructions;
+
+ protected String isRemoveContent;
+ protected String toolContentId;
+ protected String toolContentID;
+
+ /* instructions content */
+ protected String onlineInstructions;
+ protected String offlineInstructions;
+ protected FormFile theOfflineFile;
+ protected FormFile theOnlineFile;
+
+ protected String richTextOfflineInstructions;
+ protected String richTextOnlineInstructions;
+
+ /* advanced content */
+ protected String synchInMonitor;
+ protected String showFeedback;
+ protected String retries;
+ protected String sln;
+
+ protected String passmark;
+
+ protected String reportTitle;
+ protected String monitoringReportTitle;
+ protected String endLearningMessage;
+ protected String usernameVisible;
+ protected String questionsSequenced;
+
+ 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 clickedObj;
+
+ protected String edit;
+ private String contentFolderID;
+ private String editableQuestionIndex;
+ private String defineLaterInEditMode;
+ private String feedback;
+ private String candidateIndex;
+ private String totalMarks;
+ protected String currentField;
+
+ public void resetUserAction() {
+ this.editDefaultQuestion = null;
+ this.addOptionContent = null;
+ this.removeOptionContent = null;
+
+ this.fileItem = null;
+
+ this.addContent = null;
+ this.removeContent = null;
+ this.removeAllContent = null;
+ this.submitAllContent = null;
+ this.submitTabDone = null;
+ this.submitOfflineFile = null;
+ this.submitOnlineFile = null;
+
+ this.dispatch = null;
+
+ this.summaryMonitoring = null;
+ this.instructionsMonitoring = null;
+ this.editActivityMonitoring = null;
+ this.statsMonitoring = null;
+ this.edit = null;
+ this.submit = null;
}
-
- public void reset()
- {
- this.editDefaultQuestion=null;
- this.addOptionContent=null;
- this.removeOptionContent=null;
-
- this.fileItem=null;
- this.uuid=null;
- this.receivedFile=null;
-
- this.addContent=null;
- this.removeContent=null;
- this.removeAllContent=null;
- this.submitAllContent=null;
- this.submitTabDone=null;
- this.submitOfflineFile=null;
- this.submitOnlineFile=null;
- this.offlineFile=null;
-
- this.showMarks=null;
- this.dispatch=null;
+ public void reset() {
+ this.editDefaultQuestion = null;
+ this.addOptionContent = null;
+ this.removeOptionContent = null;
- this.choice=null;
- this.choiceBasic=null;
- this.choiceAdvanced=null;
- this.choiceInstructions=null;
-
- this.title=null;
- this.instructions=null;
- this.questionIndex=null;
- this.optionIndex=null;
- this.selectedIndex=null;
- this.deletableOptionIndex=null;
- this.isRemoveContent=null;
- this.toolContentId=null;
- this.toolContentID=null;
+ this.fileItem = null;
+ this.uuid = null;
+ this.receivedFile = null;
- this.onlineInstructions=null;
- this.offlineInstructions=null;
-
- this.richTextOfflineInstructions=null;
- this.richTextOnlineInstructions=null;
-
- this.endLearningMessage=null;
- this.synchInMonitor=null;
- this.reportTitle=null;
- this.monitoringReportTitle=null;
- this.questionsSequenced=null;
- this.randomize =null;
- this.displayAnswers =null;
- this.showFeedback=null;
- this.retries=null;
- this.sln=null;
- this.passmark=null;
-
- this.summaryMonitoring=null;
- this.instructionsMonitoring=null;
- this.editActivityMonitoring=null;
- this.statsMonitoring=null;
- this.edit=null;
- this.submit=null;
- }
-
- public void resetRadioBoxes()
- {
- this.synchInMonitor =OPTION_OFF;
- this.questionsSequenced =OPTION_OFF;
- this.retries =OPTION_OFF;
- this.sln =OPTION_OFF;
- this.showFeedback =OPTION_OFF;
- this.usernameVisible =OPTION_OFF;
- this.reflect ="0";
- }
+ this.addContent = null;
+ this.removeContent = null;
+ this.removeAllContent = null;
+ this.submitAllContent = null;
+ this.submitTabDone = null;
+ this.submitOfflineFile = null;
+ this.submitOnlineFile = null;
+ this.offlineFile = 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;
- }
- /**
- * @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 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 richTextOfflineInstructions.
- */
- public String getRichTextOfflineInstructions() {
- return richTextOfflineInstructions;
- }
- /**
- * @param richTextOfflineInstructions The richTextOfflineInstructions to set.
- */
- public void setRichTextOfflineInstructions(
- String richTextOfflineInstructions) {
- this.richTextOfflineInstructions = richTextOfflineInstructions;
- }
- /**
- * @return Returns the richTextOnlineInstructions.
- */
- public String getRichTextOnlineInstructions() {
- return richTextOnlineInstructions;
- }
- /**
- * @param richTextOnlineInstructions The richTextOnlineInstructions to set.
- */
- public void setRichTextOnlineInstructions(String richTextOnlineInstructions) {
- this.richTextOnlineInstructions = richTextOnlineInstructions;
- }
- /**
- * @return Returns the editDefaultQuestion.
- */
- public String getEditDefaultQuestion() {
- return editDefaultQuestion;
- }
- /**
- * @param editDefaultQuestion The editDefaultQuestion to set.
- */
- public void setEditDefaultQuestion(String editDefaultQuestion) {
- this.editDefaultQuestion = editDefaultQuestion;
- }
- /**
- * @return Returns the addOptionContent.
- */
- public String getAddOptionContent() {
- return addOptionContent;
- }
- /**
- * @param addOptionContent The addOptionContent to set.
- */
- public void setAddOptionContent(String addOptionContent) {
- this.addOptionContent = addOptionContent;
- }
- /**
- * @return Returns the removeOptionContent.
- */
- public String getRemoveOptionContent() {
- return removeOptionContent;
- }
- /**
- * @param removeOptionContent The removeOptionContent to set.
- */
- public void setRemoveOptionContent(String removeOptionContent) {
- this.removeOptionContent = removeOptionContent;
- }
- /**
- * @return Returns the optionIndex.
- */
- public String getOptionIndex() {
- return optionIndex;
- }
- /**
- * @param optionIndex The optionIndex to set.
- */
- public void setOptionIndex(String optionIndex) {
- this.optionIndex = optionIndex;
- }
- /**
- * @return Returns the retries.
- */
- public String getRetries() {
- return retries;
- }
- /**
- * @param retries The retries to set.
- */
- public void setRetries(String retries) {
- this.retries = retries;
- }
- /**
- * @return Returns the showFeedback.
- */
- public String getShowFeedback() {
- return showFeedback;
- }
- /**
- * @param showFeedback The showFeedback to set.
- */
- public void setShowFeedback(String showFeedback) {
- this.showFeedback = showFeedback;
- }
- /**
- * @return Returns the passmark.
- */
- public String getPassmark() {
- return passmark;
- }
- /**
- * @param passmark The passmark to set.
- */
- public void setPassmark(String passmark) {
- this.passmark = passmark;
- }
- /**
- * @return Returns the selectedIndex.
- */
- public String getSelectedIndex() {
- return selectedIndex;
- }
- /**
- * @param selectedIndex The selectedIndex to set.
- */
- public void setSelectedIndex(String selectedIndex) {
- this.selectedIndex = selectedIndex;
- }
- /**
- * @return Returns the deletableOptionIndex.
- */
- public String getDeletableOptionIndex() {
- return deletableOptionIndex;
- }
- /**
- * @param deletableOptionIndex The deletableOptionIndex to set.
- */
- public void setDeletableOptionIndex(String deletableOptionIndex) {
- this.deletableOptionIndex = deletableOptionIndex;
- }
- /**
- * @return Returns the sln.
- */
- public String getSln() {
- return sln;
- }
- /**
- * @param sln The sln to set.
- */
- public void setSln(String sln) {
- this.sln = sln;
- }
- /**
- * @return Returns the fileItem.
- */
- public String getFileItem() {
- return fileItem;
- }
- /**
- * @param fileItem The fileItem to set.
- */
- public void setFileItem(String fileItem) {
- this.fileItem = fileItem;
- }
- /**
- * @return Returns the receivedFile.
- */
- public FormFile getReceivedFile() {
- return receivedFile;
- }
- /**
- * @param receivedFile The receivedFile to set.
- */
- public void setReceivedFile(FormFile receivedFile) {
- this.receivedFile = receivedFile;
- }
+ this.showMarks = null;
- public String getDispatch() {
- return dispatch;
- }
+ this.dispatch = null;
- public void setDispatch(String buttonValue) {
- this.dispatch = buttonValue;
- }
-
- /**
- * @return Returns the offlineFile.
- */
- public String getOfflineFile() {
- return offlineFile;
- }
- /**
- * @param offlineFile The offlineFile to set.
- */
- public void setOfflineFile(String offlineFile) {
- this.offlineFile = offlineFile;
- }
- /**
- * @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 currentTab.
- */
- public String getCurrentTab() {
- return currentTab;
- }
- /**
- * @param currentTab The currentTab to set.
- */
- public void setCurrentTab(String currentTab) {
- this.currentTab = currentTab;
- }
- /**
- * @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 submit.
- */
- public String getSubmit() {
- return submit;
- }
- /**
- * @param submit The submit to set.
- */
- public void setSubmit(String submit) {
- this.submit = submit;
- }
+ this.choice = null;
+ this.choiceBasic = null;
+ this.choiceAdvanced = null;
+ this.choiceInstructions = null;
+ this.title = null;
+ this.instructions = null;
+ this.questionIndex = null;
+ this.optionIndex = null;
+ this.selectedIndex = null;
+ this.deletableOptionIndex = null;
+ this.isRemoveContent = null;
+ this.toolContentId = null;
+ this.toolContentID = null;
+
+ this.onlineInstructions = null;
+ this.offlineInstructions = null;
+
+ this.richTextOfflineInstructions = null;
+ this.richTextOnlineInstructions = null;
+
+ this.endLearningMessage = null;
+ this.synchInMonitor = null;
+ this.reportTitle = null;
+ this.monitoringReportTitle = null;
+ this.questionsSequenced = null;
+ this.randomize = null;
+ this.displayAnswers = null;
+ this.showFeedback = null;
+ this.retries = null;
+ this.sln = null;
+ this.passmark = null;
+
+ this.summaryMonitoring = null;
+ this.instructionsMonitoring = null;
+ this.editActivityMonitoring = null;
+ this.statsMonitoring = null;
+ this.edit = null;
+ this.submit = null;
+ }
+
+ public void resetRadioBoxes() {
+ this.synchInMonitor = OPTION_OFF;
+ this.questionsSequenced = OPTION_OFF;
+ this.retries = OPTION_OFF;
+ this.sln = OPTION_OFF;
+ this.showFeedback = OPTION_OFF;
+ this.usernameVisible = OPTION_OFF;
+ this.reflect = "0";
+ }
+
/**
+ * @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 toolContentId.
+ */
+ public String getToolContentId() {
+ return toolContentId;
+ }
+
+ /**
+ * @param toolContentId
+ * The toolContentId to set.
+ */
+ public void setToolContentId(String toolContentId) {
+ this.toolContentId = toolContentId;
+ }
+
+ /**
+ * @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 richTextOfflineInstructions.
+ */
+ public String getRichTextOfflineInstructions() {
+ return richTextOfflineInstructions;
+ }
+
+ /**
+ * @param richTextOfflineInstructions
+ * The richTextOfflineInstructions to set.
+ */
+ public void setRichTextOfflineInstructions(String richTextOfflineInstructions) {
+ this.richTextOfflineInstructions = richTextOfflineInstructions;
+ }
+
+ /**
+ * @return Returns the richTextOnlineInstructions.
+ */
+ public String getRichTextOnlineInstructions() {
+ return richTextOnlineInstructions;
+ }
+
+ /**
+ * @param richTextOnlineInstructions
+ * The richTextOnlineInstructions to set.
+ */
+ public void setRichTextOnlineInstructions(String richTextOnlineInstructions) {
+ this.richTextOnlineInstructions = richTextOnlineInstructions;
+ }
+
+ /**
+ * @return Returns the editDefaultQuestion.
+ */
+ public String getEditDefaultQuestion() {
+ return editDefaultQuestion;
+ }
+
+ /**
+ * @param editDefaultQuestion
+ * The editDefaultQuestion to set.
+ */
+ public void setEditDefaultQuestion(String editDefaultQuestion) {
+ this.editDefaultQuestion = editDefaultQuestion;
+ }
+
+ /**
+ * @return Returns the addOptionContent.
+ */
+ public String getAddOptionContent() {
+ return addOptionContent;
+ }
+
+ /**
+ * @param addOptionContent
+ * The addOptionContent to set.
+ */
+ public void setAddOptionContent(String addOptionContent) {
+ this.addOptionContent = addOptionContent;
+ }
+
+ /**
+ * @return Returns the removeOptionContent.
+ */
+ public String getRemoveOptionContent() {
+ return removeOptionContent;
+ }
+
+ /**
+ * @param removeOptionContent
+ * The removeOptionContent to set.
+ */
+ public void setRemoveOptionContent(String removeOptionContent) {
+ this.removeOptionContent = removeOptionContent;
+ }
+
+ /**
+ * @return Returns the optionIndex.
+ */
+ public String getOptionIndex() {
+ return optionIndex;
+ }
+
+ /**
+ * @param optionIndex
+ * The optionIndex to set.
+ */
+ public void setOptionIndex(String optionIndex) {
+ this.optionIndex = optionIndex;
+ }
+
+ /**
+ * @return Returns the retries.
+ */
+ public String getRetries() {
+ return retries;
+ }
+
+ /**
+ * @param retries
+ * The retries to set.
+ */
+ public void setRetries(String retries) {
+ this.retries = retries;
+ }
+
+ /**
+ * @return Returns the showFeedback.
+ */
+ public String getShowFeedback() {
+ return showFeedback;
+ }
+
+ /**
+ * @param showFeedback
+ * The showFeedback to set.
+ */
+ public void setShowFeedback(String showFeedback) {
+ this.showFeedback = showFeedback;
+ }
+
+ /**
+ * @return Returns the passmark.
+ */
+ public String getPassmark() {
+ return passmark;
+ }
+
+ /**
+ * @param passmark
+ * The passmark to set.
+ */
+ public void setPassmark(String passmark) {
+ this.passmark = passmark;
+ }
+
+ /**
+ * @return Returns the selectedIndex.
+ */
+ public String getSelectedIndex() {
+ return selectedIndex;
+ }
+
+ /**
+ * @param selectedIndex
+ * The selectedIndex to set.
+ */
+ public void setSelectedIndex(String selectedIndex) {
+ this.selectedIndex = selectedIndex;
+ }
+
+ /**
+ * @return Returns the deletableOptionIndex.
+ */
+ public String getDeletableOptionIndex() {
+ return deletableOptionIndex;
+ }
+
+ /**
+ * @param deletableOptionIndex
+ * The deletableOptionIndex to set.
+ */
+ public void setDeletableOptionIndex(String deletableOptionIndex) {
+ this.deletableOptionIndex = deletableOptionIndex;
+ }
+
+ /**
+ * @return Returns the sln.
+ */
+ public String getSln() {
+ return sln;
+ }
+
+ /**
+ * @param sln
+ * The sln to set.
+ */
+ public void setSln(String sln) {
+ this.sln = sln;
+ }
+
+ /**
+ * @return Returns the fileItem.
+ */
+ public String getFileItem() {
+ return fileItem;
+ }
+
+ /**
+ * @param fileItem
+ * The fileItem to set.
+ */
+ public void setFileItem(String fileItem) {
+ this.fileItem = fileItem;
+ }
+
+ /**
+ * @return Returns the receivedFile.
+ */
+ public FormFile getReceivedFile() {
+ return receivedFile;
+ }
+
+ /**
+ * @param receivedFile
+ * The receivedFile to set.
+ */
+ public void setReceivedFile(FormFile receivedFile) {
+ this.receivedFile = receivedFile;
+ }
+
+ public String getDispatch() {
+ return dispatch;
+ }
+
+ public void setDispatch(String buttonValue) {
+ this.dispatch = buttonValue;
+ }
+
+ /**
+ * @return Returns the offlineFile.
+ */
+ public String getOfflineFile() {
+ return offlineFile;
+ }
+
+ /**
+ * @param offlineFile
+ * The offlineFile to set.
+ */
+ public void setOfflineFile(String offlineFile) {
+ this.offlineFile = offlineFile;
+ }
+
+ /**
+ * @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 currentTab.
+ */
+ public String getCurrentTab() {
+ return currentTab;
+ }
+
+ /**
+ * @param currentTab
+ * The currentTab to set.
+ */
+ public void setCurrentTab(String currentTab) {
+ this.currentTab = currentTab;
+ }
+
+ /**
+ * @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 submit.
+ */
+ public String getSubmit() {
+ return submit;
+ }
+
+ /**
+ * @param submit
+ * The submit to set.
+ */
+ public void setSubmit(String submit) {
+ this.submit = submit;
+ }
+
+ /**
* @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 editOptionsMode.
*/
public String getEditOptionsMode() {
- return editOptionsMode;
+ return editOptionsMode;
}
+
/**
- * @param editOptionsMode The editOptionsMode to set.
+ * @param editOptionsMode
+ * The editOptionsMode to set.
*/
public void setEditOptionsMode(String editOptionsMode) {
- this.editOptionsMode = editOptionsMode;
+ this.editOptionsMode = editOptionsMode;
}
-
+
/**
* @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 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 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 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 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 candidateIndex.
*/
public String getCandidateIndex() {
- return candidateIndex;
+ return candidateIndex;
}
+
/**
- * @param candidateIndex The candidateIndex to set.
+ * @param candidateIndex
+ * The candidateIndex to set.
*/
public void setCandidateIndex(String candidateIndex) {
- this.candidateIndex = candidateIndex;
+ this.candidateIndex = candidateIndex;
}
/**
* @return Returns the totalMarks.
*/
public String getTotalMarks() {
- return totalMarks;
+ return totalMarks;
}
+
/**
- * @param totalMarks The totalMarks to set.
+ * @param totalMarks
+ * The totalMarks to set.
*/
public void setTotalMarks(String totalMarks) {
- this.totalMarks = totalMarks;
+ this.totalMarks = totalMarks;
}
+
/**
* @return Returns the clickedObj.
*/
public String getClickedObj() {
- return clickedObj;
+ return clickedObj;
}
+
/**
- * @param clickedObj The clickedObj to set.
+ * @param clickedObj
+ * The clickedObj to set.
*/
public void setClickedObj(String clickedObj) {
- this.clickedObj = clickedObj;
+ this.clickedObj = clickedObj;
}
+
/**
* @return Returns the currentField.
*/
public String getCurrentField() {
- return currentField;
+ return currentField;
}
+
/**
- * @param currentField The currentField to set.
+ * @param currentField
+ * The currentField to set.
*/
public void setCurrentField(String currentField) {
- this.currentField = currentField;
+ this.currentField = currentField;
}
+
/**
* @return Returns the showMarks.
*/
public String getShowMarks() {
- return showMarks;
+ return showMarks;
}
+
/**
- * @param showMarks The showMarks to set.
+ * @param showMarks
+ * The showMarks to set.
*/
public void setShowMarks(String showMarks) {
- this.showMarks = showMarks;
+ this.showMarks = showMarks;
}
+
/**
* @return Returns the randomize.
*/
public String getRandomize() {
- return randomize;
+ return randomize;
}
+
/**
- * @param randomize The randomize to set.
+ * @param randomize
+ * The randomize to set.
*/
public void setRandomize(String randomize) {
- this.randomize = randomize;
+ this.randomize = randomize;
}
/**
* @return Returns the displayAnswers.
*/
public String getDisplayAnswers() {
- return displayAnswers;
+ return displayAnswers;
}
+
/**
- * @param displayAnswers The displayAnswers to set.
+ * @param displayAnswers
+ * The displayAnswers to set.
*/
public void setDisplayAnswers(String displayAnswers) {
- this.displayAnswers = displayAnswers;
+ this.displayAnswers = displayAnswers;
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/Attic/McDLStarterAction.java,v
diff -u -r1.9 -r1.10
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java 8 May 2013 13:03:17 -0000 1.9
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McDLStarterAction.java 8 May 2013 13:18:25 -0000 1.10
@@ -26,44 +26,44 @@
* McDLStarterAction activates the Define Later module.
* It reuses majority of the functionality from existing authoring module.
*
-
-
+
+
-
-
-
-
-
-
-
-
-*/
+
+
+
+
+
+
+
+
+ */
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.web;
+
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
@@ -73,17 +73,16 @@
import org.lamsfoundation.lams.tool.mc.service.IMcService;
import org.lamsfoundation.lams.tool.mc.service.McServiceProxy;
-
public class McDLStarterAction extends Action implements McAppConstants {
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException, McApplicationException {
- McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
-
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- mcAuthoringForm.setMcService(mcService);
-
- McStarterAction mcStarterAction= new McStarterAction();
- return mcStarterAction.executeDefineLater(mapping, mcAuthoringForm, request, response, mcService);
- }
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, McApplicationException {
+ McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
+
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ mcAuthoringForm.setMcService(mcService);
+
+ McStarterAction mcStarterAction = new McStarterAction();
+ return mcStarterAction.executeDefineLater(mapping, mcAuthoringForm, request, response, mcService);
+ }
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java,v
diff -u -r1.7 -r1.8
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java 8 May 2013 13:03:18 -0000 1.7
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McExportForm.java 8 May 2013 13:18:25 -0000 1.8
@@ -22,7 +22,6 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.web;
-import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.lamsfoundation.lams.tool.mc.pojos.McContent;
@@ -31,112 +30,127 @@
*
*/
public class McExportForm extends ActionForm {
-
+
private String title;
- private String content;
-
- private String toolContentID;
- private String toolSessionID;
- private String userID;
- private String mode;
+ private String content;
+
+ private String toolContentID;
+ private String toolSessionID;
+ private String userID;
+ private String mode;
+
/**
* @return Returns the content.
*/
public String getContent() {
- return content;
+ return content;
}
+
/**
- * @param content The content to set.
+ * @param content
+ * The content to set.
*/
public void setContent(String content) {
- this.content = content;
+ this.content = content;
}
+
/**
* @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 title.
*/
public String getTitle() {
- return title;
+ return title;
}
+
/**
- * @param title The title to set.
+ * @param title
+ * The title to set.
*/
public void setTitle(String title) {
- this.title = title;
+ this.title = title;
}
+
/**
* @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 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;
}
-
- public void reset()
- {
- this.mode = null;
- this.title = null;
- this.content = null;
- this.toolContentID = null;
- this.toolSessionID = null;
- this.userID = null;
+
+ public void reset() {
+ this.mode = null;
+ this.title = null;
+ this.content = null;
+ this.toolContentID = null;
+ this.toolSessionID = null;
+ this.userID = null;
}
-
- public void populateForm(McContent content)
- {
- String strTitle=null;
- if (content.getTitle() == null)
- strTitle="";
- else
- strTitle=content.getTitle();
- setTitle(strTitle);
-
- String strContent=null;
- if (content.getContent() == null)
- strContent="";
- else
- strContent=content.getContent();
- setContent(strContent);
+ public void populateForm(McContent content) {
+ String strTitle = null;
+ if (content.getTitle() == null)
+ strTitle = "";
+ else
+ strTitle = content.getTitle();
+ setTitle(strTitle);
+
+ String strContent = null;
+ if (content.getContent() == null)
+ strContent = "";
+ else
+ strContent = content.getContent();
+ setContent(strContent);
}
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java,v
diff -u -r1.74 -r1.75
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 8 May 2013 13:03:18 -0000 1.74
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 8 May 2013 13:18:25 -0000 1.75
@@ -51,7 +51,6 @@
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
-import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McGeneralLearnerFlowDTO;
import org.lamsfoundation.lams.tool.mc.McLearnerAnswersDTO;
@@ -78,64 +77,25 @@
* @author Ozgur Demirtas
*
*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
*/
public class McLearningAction extends LamsDispatchAction implements McAppConstants {
static Logger logger = Logger.getLogger(McLearningAction.class.getName());
@@ -250,7 +210,7 @@
mcLearningForm.setToolContentID(toolContentId);
LearningUtil.saveFormRequestData(request, mcLearningForm, false);
- //requested learner finished, the learner should be directed to next activity
+ // requested learner finished, the learner should be directed to next activity
String userID = "";
HttpSession ss = SessionManager.getSession();
@@ -262,7 +222,7 @@
}
}
- //attempting to leave/complete session with toolSessionId:
+ // attempting to leave/complete session with toolSessionId:
McUtils.cleanUpSessionAbsolute(request);
@@ -318,8 +278,8 @@
}
/**
- *
*
+ *
* @param learnerInput
* @param mcContent
* @param mcService
@@ -516,7 +476,7 @@
boolean allQuestionsChecked = allQuestionsChecked(mcService, learnerInput, mcContent, mcTempDataHolderDTO);
if (!allQuestionsChecked) {
- //there are no selected answers for any questions
+ // there are no selected answers for any questions
ActionMessages errors = new ActionMessages();
ActionMessage error = new ActionMessage("answers.submitted.none");
@@ -568,7 +528,6 @@
isUserDefined = true;
}
-
McQueUsr mcQueUsr = null;
if (isUserDefined == false) {
mcQueUsr = LearningUtil.createUser(request, mcService, new Long(toolSessionID));
@@ -739,7 +698,7 @@
LearningWebUtil.putActivityPositionInRequestByToolSessionId(new Long(toolSessionID), request, getServlet()
.getServletContext());
-
+
return mapping.findForward(McAppConstants.LOAD_LEARNER);
}
@@ -821,7 +780,7 @@
LearningWebUtil.putActivityPositionInRequestByToolSessionId(new Long(toolSessionID), request, getServlet()
.getServletContext());
-
+
return mapping.findForward(McAppConstants.REDO_QUESTIONS);
}
@@ -1059,7 +1018,7 @@
/* it is possible that mcQueUsr can be null if the content is set as runoffline and reflection is on */
if (mcQueUsr == null) {
- //attempt creating user record since it must exist for the runOffline + reflection screens
+ // attempt creating user record since it must exist for the runOffline + reflection screens
HttpSession ss = SessionManager.getSession();
UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
@@ -1127,7 +1086,7 @@
}
}
- //attempt getting notebookEntry
+ // attempt getting notebookEntry
NotebookEntry notebookEntry = mcService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL,
McAppConstants.MY_SIGNATURE, new Integer(userID));
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java,v
diff -u -r1.29 -r1.30
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java 25 Mar 2013 12:50:35 -0000 1.29
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningForm.java 8 May 2013 13:18:25 -0000 1.30
@@ -32,7 +32,7 @@
/**
* @author Ozgur Demirtas
*
- * ActionForm for the Learning environment
+ * ActionForm for the Learning environment
*/
public class McLearningForm extends ActionForm implements McAppConstants {
protected String continueOptions;
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java,v
diff -u -r1.80 -r1.81
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 8 May 2013 13:03:18 -0000 1.80
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 8 May 2013 13:18:25 -0000 1.81
@@ -140,8 +140,8 @@
HttpServletResponse response) throws IOException, ServletException, McApplicationException {
/*
- * By now, the passed tool session id MUST exist in the db through the calling of:
- * public void createToolSession(Long toolSessionId, Long toolContentId) by the container.
+ * By now, the passed tool session id MUST exist in the db through the calling of: public void
+ * createToolSession(Long toolSessionId, Long toolContentId) by the container.
*
* make sure this session exists in tool's session table by now.
*/
@@ -173,8 +173,8 @@
mcLearningForm.setToolSessionID(new Long(toolSessionID).toString());
/*
- * 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 the relavent content
+ * 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 the relavent content
*/
McSession mcSession = mcService.retrieveMcSession(new Long(toolSessionID));
@@ -185,9 +185,8 @@
}
/*
- * find out what content this tool session is referring to
- * get the content for this tool session
- * Each passed tool session id points to a particular content. Many to one mapping.
+ * find out what content this tool session is referring to get the content for this tool session Each passed
+ * tool session id points to a particular content. Many to one mapping.
*/
McContent mcContent = mcSession.getMcContent();
@@ -198,8 +197,8 @@
}
/*
- * The content we retrieved above must have been created before in Authoring time.
- * And the passed tool session id already refers to it.
+ * The content we retrieved above must have been created before in Authoring time. And the passed tool session
+ * id already refers to it.
*/
McLearnerStarterDTO mcLearnerStarterDTO = new McLearnerStarterDTO();
@@ -211,7 +210,7 @@
mcLearningForm.setQuestionListingMode(McAppConstants.QUESTION_LISTING_MODE_COMBINED);
}
- /*
+ /*
* Is there a deadline set?
*/
@@ -243,7 +242,10 @@
mcLearningForm.setToolContentID(mcContent.getMcContentId().toString());
commonContentSetup(request, mcContent, mcService, mcLearningForm, toolSessionID);
- /* 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. */
+ /*
+ * 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 = McUtils.isRunOffline(mcContent);
if (isRunOffline == true) {
return (mapping.findForward(McAppConstants.RUN_OFFLINE));
@@ -255,33 +257,33 @@
return (mapping.findForward(McAppConstants.DEFINE_LATER));
}
- /* 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
- */
+ /*
+ * 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
+ */
- /*handle PREVIEW mode*/
+ /* handle PREVIEW mode */
// String mode=mcLearningForm.getLearningMode();
String mode = request.getParameter(McAppConstants.MODE);
- /* by now, we know that the mode is either teacher or learner
- * check if the mode is teacher and request is for Learner Progress
- */
+ /*
+ * by now, we know that the mode is either teacher or learner check if the mode is teacher and request is for
+ * Learner Progress
+ */
String userId = request.getParameter(McAppConstants.USER_ID);
if ((userId != null) && (mode.equals("teacher"))) {
- /* LEARNER_PROGRESS for jsp*/
+ /* LEARNER_PROGRESS for jsp */
mcLearningForm.setLearnerProgress(new Boolean(true).toString());
mcLearningForm.setLearnerProgressUserId(userId);
McLearningAction mcLearningAction = new McLearningAction();
- /* pay attention that this userId is the learner's userId passed by the request parameter.
- * It is differerent than USER_ID kept in the session of the current system user*/
+ /*
+ * pay attention that this userId is the learner's userId passed by the request parameter. It is differerent
+ * than USER_ID kept in the session of the current system user
+ */
McQueUsr mcQueUsr = mcService.getMcUserBySession(new Long(userId), mcSession.getUid());
if (mcQueUsr == null) {
@@ -291,7 +293,7 @@
return (mapping.findForward(McAppConstants.SIMPLE_LEARNING_ERROR));
}
- /* check whether the user's session really referrs to the session id passed to the url*/
+ /* check whether the user's session really referrs to the session id passed to the url */
Long sessionUid = mcQueUsr.getMcSessionId();
McSession mcSessionLocal = mcService.getMcSessionByUID(sessionUid);
@@ -307,13 +309,11 @@
return mcLearningAction.viewAnswers(mapping, mcLearningForm, request, response);
}
- /* by now, we know that the mode is learner*/
+ /* by now, we know that the mode is learner */
/*
- * verify that userId does not already exist in the db.
- * If it does exist, that means, that user already responded to the content and
- * his answers must be displayed read-only
- *
- */
+ * verify that userId does not already exist in the db. If it does exist, that means, that user already
+ * responded to the content and his answers must be displayed read-only
+ */
Integer userID = null;
HttpSession ss = SessionManager.getSession();
@@ -337,7 +337,8 @@
if (toolSessionID.equals(userSessionId)) {
McLearningAction mcLearningAction = new McLearningAction();
request.setAttribute(McAppConstants.REQUEST_BY_STARTER, (Boolean.TRUE).toString());
- mcLearningAction.prepareViewAnswersData(mapping, mcLearningForm, request, getServlet().getServletContext());
+ mcLearningAction.prepareViewAnswersData(mapping, mcLearningForm, request, getServlet()
+ .getServletContext());
return mapping.findForward(McAppConstants.VIEW_ANSWERS);
}
} else if (mode.equals("teacher")) {
@@ -396,8 +397,8 @@
protected ActionForward validateParameters(HttpServletRequest request, McLearningForm mcLearningForm,
ActionMapping mapping) {
/*
- * obtain and setup the current user's data
- */
+ * obtain and setup the current user's data
+ */
String userID = "";
HttpSession ss = SessionManager.getSession();
@@ -412,7 +413,7 @@
mcLearningForm.setUserID(userID);
/*
- * process incoming tool session id and later derive toolContentId from it.
+ * process incoming tool session id and later derive toolContentId from it.
*/
String strToolSessionId = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID);
long toolSessionId = 0;
@@ -426,7 +427,7 @@
}
}
- /*mode can be learner, teacher or author */
+ /* mode can be learner, teacher or author */
String mode = request.getParameter(McAppConstants.MODE);
if ((mode == null) || (mode.length() == 0)) {
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java,v
diff -u -r1.48 -r1.49
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 8 May 2013 13:03:18 -0000 1.48
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 8 May 2013 13:18:25 -0000 1.49
@@ -55,7 +55,6 @@
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.mc.EditActivityDTO;
import org.lamsfoundation.lams.tool.mc.McAppConstants;
-import org.lamsfoundation.lams.tool.mc.McApplicationException;
import org.lamsfoundation.lams.tool.mc.McCandidateAnswersDTO;
import org.lamsfoundation.lams.tool.mc.McComparator;
import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO;
@@ -85,74 +84,37 @@
/**
* * @author Ozgur Demirtas
*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ *
*
-*/
-public class McMonitoringAction extends LamsDispatchAction implements McAppConstants
-{
- static Logger logger= Logger.getLogger(McMonitoringAction.class.getName());
-
- /**
- * main content/question content management and workflow logic
- *
- */
- public ActionForward unspecified(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException
- {
- return null;
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+public class McMonitoringAction extends LamsDispatchAction implements McAppConstants {
+ static Logger logger = Logger.getLogger(McMonitoringAction.class.getName());
+
+ /**
+ * main content/question content management and workflow logic
+ *
+ */
+ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ return null;
}
-
/**
* @param form
* @param request
@@ -161,230 +123,199 @@
* @throws IOException
* @throws ServletException
*/
- protected ActionForward commonSubmitSessionCode(McMonitoringForm mcMonitoringForm, HttpServletRequest request, ActionMapping mapping,
- IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, ServletException
- {
-
- repopulateRequestParameters(request, mcMonitoringForm, mcGeneralMonitoringDTO);
+ protected ActionForward commonSubmitSessionCode(McMonitoringForm mcMonitoringForm, HttpServletRequest request,
+ ActionMapping mapping, IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO)
+ throws IOException, ServletException {
- String currentMonitoredToolSession=request.getParameter("monitoredToolSessionId");
-
- if (currentMonitoredToolSession == null)
- {
- //default to All
- currentMonitoredToolSession="All";
- }
-
-
- String toolContentID =mcMonitoringForm.getToolContentID();
-
- McContent mcContent=mcService.retrieveMc(new Long(toolContentID));
-
- if (currentMonitoredToolSession.equals("All"))
- {
- List listMcAllSessionsDTO = new LinkedList();
- //generate DTO for All sessions
- MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ repopulateRequestParameters(request, mcMonitoringForm, mcGeneralMonitoringDTO);
- mcGeneralMonitoringDTO.setSelectionCase(new Long(2));
- request.setAttribute(SELECTION_CASE, new Long(2));
+ String currentMonitoredToolSession = request.getParameter("monitoredToolSessionId");
+
+ if (currentMonitoredToolSession == null) {
+ // default to All
+ currentMonitoredToolSession = "All";
+ }
+
+ String toolContentID = mcMonitoringForm.getToolContentID();
+
+ McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
+
+ if (currentMonitoredToolSession.equals("All")) {
+ List listMcAllSessionsDTO = new LinkedList();
+ // generate DTO for All sessions
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ mcGeneralMonitoringDTO.setSelectionCase(new Long(2));
+ request.setAttribute(SELECTION_CASE, new Long(2));
+ } else {
+ McSession mcSession = mcService.retrieveMcSession(new Long(currentMonitoredToolSession));
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ mcGeneralMonitoringDTO.setGroupName(mcSession.getSession_name());
+ mcGeneralMonitoringDTO.setSelectionCase(new Long(1));
+ request.setAttribute(SELECTION_CASE, new Long(1));
+ }
+
+ request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, currentMonitoredToolSession);
+
+ mcGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession);
+ mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
+
+ mcGeneralMonitoringDTO.setSummaryToolSessions(populateToolSessions(mcContent));
+ mcGeneralMonitoringDTO.setDisplayAnswers(new Boolean(mcContent.isDisplayAnswers()).toString());
+
+ boolean isGroupedActivity = mcService.isGroupedActivity(new Long(toolContentID));
+ request.setAttribute("isGroupedActivity", isGroupedActivity);
+
+ /* setting editable screen properties */
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
+ mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
+
+ Map mapOptionsContent = new TreeMap(new McComparator());
+ Iterator queIterator = mcContent.getMcQueContents().iterator();
+ Long mapIndex = new Long(1);
+ while (queIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) queIterator.next();
+ if (mcQueContent != null) {
+ mapOptionsContent.put(mapIndex.toString(), mcQueContent.getQuestion());
+
+ mapIndex = new Long(mapIndex.longValue() + 1);
}
- else
- {
- McSession mcSession=mcService.retrieveMcSession(new Long(currentMonitoredToolSession));
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
-
- mcGeneralMonitoringDTO.setGroupName(mcSession.getSession_name());
- mcGeneralMonitoringDTO.setSelectionCase(new Long(1));
- request.setAttribute(SELECTION_CASE, new Long(1));
- }
-
- request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, currentMonitoredToolSession);
+ }
-
- mcGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession);
- mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
-
- mcGeneralMonitoringDTO.setSummaryToolSessions(populateToolSessions(mcContent));
- mcGeneralMonitoringDTO.setDisplayAnswers(new Boolean(mcContent.isDisplayAnswers()).toString());
-
- boolean isGroupedActivity = mcService.isGroupedActivity(new Long(toolContentID));
- request.setAttribute("isGroupedActivity", isGroupedActivity);
+ int maxIndex = mapOptionsContent.size();
- /*setting editable screen properties*/
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
- mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
+ boolean isContentInUse = McUtils.isContentInUse(mcContent);
+ mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString());
+ if (isContentInUse == true) {
+ // monitoring url does not allow editActivity since the content is in use
+ mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString());
+ }
- Map mapOptionsContent= new TreeMap(new McComparator());
- Iterator queIterator=mcContent.getMcQueContents().iterator();
- Long mapIndex=new Long(1);
- while (queIterator.hasNext())
- {
- McQueContent mcQueContent=(McQueContent) queIterator.next();
- if (mcQueContent != null)
- {
- mapOptionsContent.put(mapIndex.toString(),mcQueContent.getQuestion());
-
- mapIndex=new Long(mapIndex.longValue()+1);
- }
- }
-
- int maxIndex=mapOptionsContent.size();
-
- boolean isContentInUse=McUtils.isContentInUse(mcContent);
- mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString());
- if (isContentInUse == true)
- {
- //monitoring url does not allow editActivity since the content is in use
- mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString());
- }
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- prepareReflectionData(request, mcContent, mcService, null, false, "All");
+ prepareReflectionData(request, mcContent, mcService, null, false, "All");
- if (mcService.studentActivityOccurredGlobal(mcContent))
- {
- //USER_EXCEPTION_NO_TOOL_SESSIONS is set to false
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
- }
- else
- {
- //USER_EXCEPTION_NO_TOOL_SESSIONS is set to true
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
- }
-
- /**getting instructions screen content from here... */
- mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
-
- List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
- mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
- mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
- /** ...till here **/
+ if (mcService.studentActivityOccurredGlobal(mcContent)) {
+ // USER_EXCEPTION_NO_TOOL_SESSIONS is set to false
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
+ } else {
+ // USER_EXCEPTION_NO_TOOL_SESSIONS is set to true
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
+ }
+ /** getting instructions screen content from here... */
+ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
- request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
-
- EditActivityDTO editActivityDTO = new EditActivityDTO();
- if (isContentInUse == true)
- {
- editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString());
- }
- request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO);
-
-
- /*find out if there are any reflection entries, from here*/
- boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent);
-
- if (notebookEntriesExist)
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
-
- String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
-
- if (userExceptionNoToolSessions.equals("true"))
- {
- //there are no online student activity but there are reflections
- request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
- }
- }
- else
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
- }
- /* ... till here*/
-
- MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
-
- return (mapping.findForward(LOAD_MONITORING_CONTENT));
+ List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
+ mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
+ mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
+ /** ...till here **/
- }
-
- /**
- * Populates a sorted map of the tool session where the key is the mcSessionId and the value is name of the session.
- * If no sessions exists, there will be a single entry "None", otherwise on the end of the list will be the entry "All"
- */
- public static Map populateToolSessions(McContent mcContent)
- {
- Map sessionsMap = new TreeMap();
- Iterator iter = mcContent.getMcSessions().iterator();
- while (iter.hasNext()) {
- McSession elem = (McSession) iter.next();
- sessionsMap.put(elem.getMcSessionId().toString(), elem.getSession_name() );
- }
+ request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
- if (sessionsMap.isEmpty())
- {
- sessionsMap.put("None", "None");
- }
- else
- {
- sessionsMap.put("All" , "All");
- }
-
+ EditActivityDTO editActivityDTO = new EditActivityDTO();
+ if (isContentInUse == true) {
+ editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString());
+ }
+ request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO);
- return sessionsMap;
+ /* find out if there are any reflection entries, from here */
+ boolean notebookEntriesExist = MonitoringUtil.notebookEntriesExist(mcService, mcContent);
+ if (notebookEntriesExist) {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+
+ String userExceptionNoToolSessions = (String) mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
+
+ if (userExceptionNoToolSessions.equals("true")) {
+ // there are no online student activity but there are reflections
+ request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+ }
+ } else {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
}
+ /* ... till here */
- /**
- *
- * submitSession
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward submitSession(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException,ServletException
- {
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- mcContent.setDisplayAnswers(new Boolean(true));
- return commonSubmitSessionCode((McMonitoringForm) form, request, mapping, mcService, new McGeneralMonitoringDTO() );
+ MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return (mapping.findForward(LOAD_MONITORING_CONTENT));
+
+ }
+
+ /**
+ * Populates a sorted map of the tool session where the key is the mcSessionId and the value is name of the session.
+ * If no sessions exists, there will be a single entry "None", otherwise on the end of the list will be the entry
+ * "All"
+ */
+ public static Map populateToolSessions(McContent mcContent) {
+ Map sessionsMap = new TreeMap();
+ Iterator iter = mcContent.getMcSessions().iterator();
+ while (iter.hasNext()) {
+ McSession elem = (McSession) iter.next();
+ sessionsMap.put(elem.getMcSessionId().toString(), elem.getSession_name());
}
- /**
- * displayAnswers
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward displayAnswers(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)
- throws IOException,ServletException
- {
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- mcContent.setDisplayAnswers(new Boolean(true));
- return commonSubmitSessionCode((McMonitoringForm) form, request, mapping, mcService, new McGeneralMonitoringDTO() );
+ if (sessionsMap.isEmpty()) {
+ sessionsMap.put("None", "None");
+ } else {
+ sessionsMap.put("All", "All");
}
-
-
+ return sessionsMap;
+
+ }
+
/**
+ *
+ * submitSession
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward submitSession(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ mcContent.setDisplayAnswers(new Boolean(true));
+ return commonSubmitSessionCode((McMonitoringForm) form, request, mapping, mcService,
+ new McGeneralMonitoringDTO());
+ }
+
+ /**
+ * displayAnswers
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward displayAnswers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ mcContent.setDisplayAnswers(new Boolean(true));
+ return commonSubmitSessionCode((McMonitoringForm) form, request, mapping, mcService,
+ new McGeneralMonitoringDTO());
+ }
+
+ /**
* editActivityQuestions
*
* enables swiching to editable mode in the Edit Activity tab
@@ -398,176 +329,147 @@
* @throws ServletException
* @throws ToolException
*/
- public ActionForward editActivityQuestions(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException,
- ToolException
- {
-
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
+ public ActionForward editActivityQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, ToolException {
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String activeModule=request.getParameter(ACTIVE_MODULE);
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
- //String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
-
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
- mcAuthoringForm.setTitle(mcContent.getTitle());
-
- mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
-
- /* determine whether the request is from Monitoring url Edit Activity*/
- String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
- mcAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString());
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- boolean isContentInUse=McUtils.isContentInUse(mcContent);
-
- mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(false).toString());
- if (isContentInUse == true)
- {
- //monitoring url does not allow editActivity since the content is in use
- persistError(request,"error.content.inUse");
- mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString());
- }
-
- EditActivityDTO editActivityDTO = new EditActivityDTO();
- if (isContentInUse == true)
- {
- editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString());
- }
- request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
- McUtils.setDefineLater(request, true, strToolContentID, mcService);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ // String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR);
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
- List listQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
+ mcAuthoringForm.setTitle(mcContent.getTitle());
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- request.getSession().setAttribute(httpSessionID, sessionMap);
+ mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ /* determine whether the request is from Monitoring url Edit Activity */
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
-
-
- /*setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */
- McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO();
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- if (mcService.studentActivityOccurredGlobal(mcContent))
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
- }
- else
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
- }
-
-
- mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
-
- List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
- mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
- mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
-
+ mcAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString());
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
- /*.. till here*/
-
-
- /*find out if there are any reflection entries, from here*/
- boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent);
-
- if (notebookEntriesExist)
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
-
- String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
-
- if (userExceptionNoToolSessions.equals("true"))
- {
- //there are no online student activity but there are reflections
- request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
- }
- }
- else
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
- }
- /* ... till here*/
- MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
- MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
-
+ boolean isContentInUse = McUtils.isContentInUse(mcContent);
- return mapping.findForward(LOAD_MONITORING_CONTENT);
- }
-
-
+ mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(false).toString());
+ if (isContentInUse == true) {
+ // monitoring url does not allow editActivity since the content is in use
+ persistError(request, "error.content.inUse");
+ mcGeneralAuthoringDTO.setMonitoredContentInUse(new Boolean(true).toString());
+ }
+ EditActivityDTO editActivityDTO = new EditActivityDTO();
+ if (isContentInUse == true) {
+ editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString());
+ }
+ request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO);
+
+ McUtils.setDefineLater(request, true, strToolContentID, mcService);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List listQuestionContentDTO = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ /* setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */
+ McGeneralMonitoringDTO mcGeneralMonitoringDTO = new McGeneralMonitoringDTO();
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ if (mcService.studentActivityOccurredGlobal(mcContent)) {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
+ } else {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
+ }
+
+ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
+
+ List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
+ mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
+ mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
+
+ request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
+ /* .. till here */
+
+ /* find out if there are any reflection entries, from here */
+ boolean notebookEntriesExist = MonitoringUtil.notebookEntriesExist(mcService, mcContent);
+
+ if (notebookEntriesExist) {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+
+ String userExceptionNoToolSessions = (String) mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
+
+ if (userExceptionNoToolSessions.equals("true")) {
+ // there are no online student activity but there are reflections
+ request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+ }
+ } else {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
+ }
+ /* ... till here */
+ MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
+ MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return mapping.findForward(LOAD_MONITORING_CONTENT);
+ }
+
/**
* 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));
- saveErrors(request,errors);
- }
-
-
+ public void persistError(HttpServletRequest request, String message) {
+ ActionMessages errors = new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage(message));
+ saveErrors(request, errors);
+ }
-
-
/**
*
- submits content into the tool database
+ submits content into the tool database
*
* @param mapping
* @param form
@@ -577,247 +479,220 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
-
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
+ public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String activeModule=request.getParameter(ACTIVE_MODULE);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
-
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- Map mapQuestionContent=AuthoringUtil.extractMapQuestionContent(listQuestionContentDTO);
-
- Map mapFeedback=AuthoringUtil.extractMapFeedback(listQuestionContentDTO);
-
- Map mapWeights=new TreeMap(new McComparator());
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
- String totalMarks=request.getParameter("totalMarks");
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- Map mapMarks=AuthoringUtil.extractMapMarks(listQuestionContentDTO);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
- Map mapCandidatesList=AuthoringUtil.extractMapCandidatesList(listQuestionContentDTO);
-
- ActionMessages errors = new ActionMessages();
-
- if (mapQuestionContent.size() == 0)
- {
- ActionMessage error = new ActionMessage("questions.none.submitted");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
-
- if (activeModule.equals(AUTHORING))
- {
- List attachmentListBackup= new ArrayList();
- List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY);
- attachmentListBackup=attachmentList;
-
- List deletedAttachmentListBackup= new ArrayList();
- List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
- deletedAttachmentListBackup=deletedAttachmentList;
-
- String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
- mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
- mcGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
- mcGeneralAuthoringDTO.setAttachmentList(attachmentList);
- mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList);
-
- String strOnlineInstructions= request.getParameter("onlineInstructions");
- String strOfflineInstructions= request.getParameter("offlineInstructions");
- mcAuthoringForm.setOfflineInstructions(strOfflineInstructions);
- mcAuthoringForm.setOnlineInstructions(strOnlineInstructions);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- }
-
-
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
- mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ Map mapQuestionContent = AuthoringUtil.extractMapQuestionContent(listQuestionContentDTO);
- McContent mcContentTest=mcService.retrieveMc(new Long(strToolContentID));
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
+ Map mapFeedback = AuthoringUtil.extractMapFeedback(listQuestionContentDTO);
+
+ Map mapWeights = new TreeMap(new McComparator());
+
+ String totalMarks = request.getParameter("totalMarks");
+
+ Map mapMarks = AuthoringUtil.extractMapMarks(listQuestionContentDTO);
+
+ Map mapCandidatesList = AuthoringUtil.extractMapCandidatesList(listQuestionContentDTO);
+
+ ActionMessages errors = new ActionMessages();
+
+ if (mapQuestionContent.size() == 0) {
+ ActionMessage error = new ActionMessage("questions.none.submitted");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+
+ if (activeModule.equals(AUTHORING)) {
+ List attachmentListBackup = new ArrayList();
+ List attachmentList = (List) sessionMap.get(ATTACHMENT_LIST_KEY);
+ attachmentListBackup = attachmentList;
+
+ List deletedAttachmentListBackup = new ArrayList();
+ List deletedAttachmentList = (List) sessionMap.get(DELETED_ATTACHMENT_LIST_KEY);
+ deletedAttachmentListBackup = deletedAttachmentList;
+
+ String onlineInstructions = (String) sessionMap.get(ONLINE_INSTRUCTIONS_KEY);
+ mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String offlineInstructions = (String) sessionMap.get(OFFLINE_INSTRUCTIONS_KEY);
+ mcGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ mcGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList);
+
+ String strOnlineInstructions = request.getParameter("onlineInstructions");
+ String strOfflineInstructions = request.getParameter("offlineInstructions");
+ mcAuthoringForm.setOfflineInstructions(strOfflineInstructions);
+ mcAuthoringForm.setOnlineInstructions(strOnlineInstructions);
+
+ }
+
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+ mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ McContent mcContentTest = mcService.retrieveMc(new Long(strToolContentID));
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
+
+ McGeneralMonitoringDTO mcGeneralMonitoringDTO = new McGeneralMonitoringDTO();
+
+ McContent mcContent = mcContentTest;
+ if (errors.isEmpty()) {
+ authoringUtil.removeRedundantQuestions(mapQuestionContent, mcService, mcAuthoringForm, request,
+ strToolContentID);
+
+ mcContent = authoringUtil.saveOrUpdateMcContent(mapQuestionContent, mapFeedback, mapWeights, mapMarks,
+ mapCandidatesList, mcService, mcAuthoringForm, request, mcContentTest, strToolContentID);
+
+ long defaultContentID = 0;
+ defaultContentID = mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
+
+ if (mcContent != null) {
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
+ }
+
+ authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, mcService, mcAuthoringForm, mcContent);
+
+ McUtils.setDefineLater(request, false, strToolContentID, mcService);
+ // define later set to false
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ // go back to view only screen
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
+ } else {
+ // errors is not empty
+
+ if (mcContent != null) {
+ long defaultContentID = 0;
+ defaultContentID = mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
+
+ if (mcContent != null) {
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
}
-
- McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO();
- McContent mcContent=mcContentTest;
- if(errors.isEmpty()){
- authoringUtil.removeRedundantQuestions(mapQuestionContent, mcService, mcAuthoringForm, request, strToolContentID);
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
- mcContent=authoringUtil.saveOrUpdateMcContent(mapQuestionContent, mapFeedback, mapWeights,
- mapMarks, mapCandidatesList, mcService, mcAuthoringForm, request, mcContentTest, strToolContentID);
-
-
- long defaultContentID=0;
- defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
-
- if (mcContent != null)
- {
- mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
- }
-
- authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, mcService, mcAuthoringForm, mcContent);
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ }
+ }
+ request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
- McUtils.setDefineLater(request, false, strToolContentID, mcService);
- //define later set to false
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+ mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString());
- //go back to view only screen
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
- }
- else
- {
- //errors is not empty
-
- if (mcContent != null)
- {
- long defaultContentID=0;
- defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
-
- if (mcContent != null)
- {
- mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
- }
+ mcAuthoringForm.resetUserAction();
+ mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- }
- }
- request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
-
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
- mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString());
-
- mcAuthoringForm.resetUserAction();
- mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
-
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ request.getSession().setAttribute(httpSessionID, sessionMap);
-
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
-
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
-
- /*common screen data*/
- if (mcService.studentActivityOccurredGlobal(mcContent))
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
- }
- else
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
- }
-
-
- mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
-
- List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
- mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
- mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
-
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- /*find out if there are any reflection entries, from here*/
- boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent);
-
- if (notebookEntriesExist)
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
-
- String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
-
- if (userExceptionNoToolSessions.equals("true"))
- {
- //there are no online student activity but there are reflections
- request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
- }
- }
- else
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
- }
- /* ... till here*/
- MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
- MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
-
- return mapping.findForward(LOAD_MONITORING);
+ /* common screen data */
+ if (mcService.studentActivityOccurredGlobal(mcContent)) {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
+ } else {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
+ }
+
+ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
+
+ List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
+ mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
+ mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
+
+ /* find out if there are any reflection entries, from here */
+ boolean notebookEntriesExist = MonitoringUtil.notebookEntriesExist(mcService, mcContent);
+
+ if (notebookEntriesExist) {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+
+ String userExceptionNoToolSessions = (String) mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
+
+ if (userExceptionNoToolSessions.equals("true")) {
+ // there are no online student activity but there are reflections
+ request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+ }
+ } else {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
+ }
+ /* ... till here */
+ MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
+ MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return mapping.findForward(LOAD_MONITORING);
}
-
/**
*
* @param mapping
@@ -828,291 +703,251 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward saveSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
-
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
- String totalMarks=request.getParameter("totalMarks");
- String mark=request.getParameter("mark");
- String passmark=request.getParameter("passmark");
-
- AuthoringUtil authoringUtil = new AuthoringUtil();
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
-
- caList=AuthoringUtil.removeBlankEntries(caList);
-
+ public ActionForward saveSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
- boolean validateSingleCorrectCandidate=authoringUtil.validateSingleCorrectCandidate(caList);
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- boolean validateOnlyOneCorrectCandidate=authoringUtil.validateOnlyOneCorrectCandidate(caList);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+ String totalMarks = request.getParameter("totalMarks");
+ String mark = request.getParameter("mark");
+ String passmark = request.getParameter("passmark");
-
-
- ActionMessages errors = new ActionMessages();
-
-
- if (!validateSingleCorrectCandidate)
- {
- ActionMessage error = new ActionMessage("candidates.none.correct");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
- if (!validateOnlyOneCorrectCandidate)
- {
- ActionMessage error = new ActionMessage("candidates.duplicate.correct");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
+ caList = AuthoringUtil.removeBlankEntries(caList);
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
+ boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList);
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
+ boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList);
- mcGeneralAuthoringDTO.setMarkValue(mark);
- mcGeneralAuthoringDTO.setPassMarkValue(passmark);
+ ActionMessages errors = new ActionMessages();
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
+ if (!validateSingleCorrectCandidate) {
+ ActionMessage error = new ActionMessage("candidates.none.correct");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
-
- if(errors.isEmpty())
- {
- //errors is empty
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
-
- String newQuestion=request.getParameter("newQuestion");
- String feedback=request.getParameter("feedback");
-
- String editableQuestionIndex=request.getParameter("editableQuestionIndex");
- mcAuthoringForm.setQuestionIndex(editableQuestionIndex);
-
+ if (!validateOnlyOneCorrectCandidate) {
+ ActionMessage error = new ActionMessage("candidates.duplicate.correct");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
- if ((newQuestion != null) && (newQuestion.length() > 0))
- {
- if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false")))
- {
- boolean duplicates=AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
- if (!duplicates)
- {
- McQuestionContentDTO mcQuestionContentDTO= null;
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(editableQuestionIndex))
- {
- break;
- }
-
- }
- }
-
- mcQuestionContentDTO.setQuestion(newQuestion);
- mcQuestionContentDTO.setFeedback(feedback);
- mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
- mcQuestionContentDTO.setMark(mark);
-
- mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString());
-
-
- listQuestionContentDTO=AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex);
- }
- else
- {
- //duplicate question entry, not adding
- }
- }
- else
- {
- //request for edit and save
- McQuestionContentDTO mcQuestionContentDTO= null;
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(editableQuestionIndex))
- {
- break;
- }
-
- }
- }
-
- mcQuestionContentDTO.setQuestion(newQuestion);
- mcQuestionContentDTO.setFeedback(feedback);
- mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
- mcQuestionContentDTO.setMark(mark);
-
- mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString());
-
- listQuestionContentDTO=AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex);
- }
- }
- else
- {
- //entry blank, not adding
- }
-
- mcGeneralAuthoringDTO.setMarkValue(mark);
-
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
- commonSaveCode(request, mcGeneralAuthoringDTO,
- mcAuthoringForm, sessionMap, activeModule, strToolContentID,
- defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- setupCommonScreenData(mcContent, mcService,request);
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
-
- return (mapping.findForward(LOAD_MONITORING));
- }
- else
- {
- //errors is not empty
- commonSaveCode(request, mcGeneralAuthoringDTO,
- mcAuthoringForm, sessionMap, activeModule, strToolContentID,
- defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+ mcGeneralAuthoringDTO.setPassMarkValue(passmark);
-
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ if (errors.isEmpty()) {
+ // errors is empty
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- setupCommonScreenData(mcContent, mcService,request);
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
- request.setAttribute("requestNewEditableQuestionBox",new Boolean(true).toString());
-
- return newEditableQuestionBox(mapping, form, request, response);
- }
+ String newQuestion = request.getParameter("newQuestion");
+ String feedback = request.getParameter("feedback");
- }
+ String editableQuestionIndex = request.getParameter("editableQuestionIndex");
+ mcAuthoringForm.setQuestionIndex(editableQuestionIndex);
-
- /**
- *
- * @param request
- * @param mcGeneralAuthoringDTO
- * @param mcAuthoringForm
- * @param sessionMap
- * @param activeModule
- * @param strToolContentID
- * @param defaultContentIdStr
- * @param mcService
- * @param httpSessionID
- * @param listQuestionContentDTO
- */
- protected void commonSaveCode(HttpServletRequest request, McGeneralAuthoringDTO mcGeneralAuthoringDTO,
- McAuthoringForm mcAuthoringForm, SessionMap sessionMap, String activeModule, String strToolContentID,
- String defaultContentIdStr, IMcService mcService, String httpSessionID, List listQuestionContentDTO)
- {
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ if ((newQuestion != null) && (newQuestion.length() > 0)) {
+ if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false"))) {
+ boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
+ if (!duplicates) {
+ McQuestionContentDTO mcQuestionContentDTO = null;
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(editableQuestionIndex)) {
+ break;
+ }
+
+ }
+ }
+
+ mcQuestionContentDTO.setQuestion(newQuestion);
+ mcQuestionContentDTO.setFeedback(feedback);
+ mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+ mcQuestionContentDTO.setMark(mark);
+
+ mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO()
+ .size()).toString());
+
+ listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(
+ listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex);
+ } else {
+ // duplicate question entry, not adding
+ }
+ } else {
+ // request for edit and save
+ McQuestionContentDTO mcQuestionContentDTO = null;
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
+
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(editableQuestionIndex)) {
+ break;
+ }
+
+ }
+ }
+
+ mcQuestionContentDTO.setQuestion(newQuestion);
+ mcQuestionContentDTO.setFeedback(feedback);
+ mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+ mcQuestionContentDTO.setMark(mark);
+
+ mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO()
+ .size()).toString());
+
+ listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO,
+ mcQuestionContentDTO, editableQuestionIndex);
+ }
+ } else {
+ // entry blank, not adding
+ }
+
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
-
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
+ defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
-
- AuthoringUtil authoringUtil = new AuthoringUtil();
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ setupCommonScreenData(mcContent, mcService, request);
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return (mapping.findForward(LOAD_MONITORING));
+ } else {
+ // errors is not empty
+ commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
+ defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ setupCommonScreenData(mcContent, mcService, request);
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString());
+
+ return newEditableQuestionBox(mapping, form, request, response);
}
-
-
+ }
+
/**
*
+ * @param request
+ * @param mcGeneralAuthoringDTO
+ * @param mcAuthoringForm
+ * @param sessionMap
+ * @param activeModule
+ * @param strToolContentID
+ * @param defaultContentIdStr
+ * @param mcService
+ * @param httpSessionID
+ * @param listQuestionContentDTO
+ */
+ protected void commonSaveCode(HttpServletRequest request, McGeneralAuthoringDTO mcGeneralAuthoringDTO,
+ McAuthoringForm mcAuthoringForm, SessionMap sessionMap, String activeModule, String strToolContentID,
+ String defaultContentIdStr, IMcService mcService, String httpSessionID, List listQuestionContentDTO) {
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+ }
+
+ /**
+ *
* @param mapping
* @param form
* @param request
@@ -1121,165 +956,147 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward addSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
-
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
- String totalMarks=request.getParameter("totalMarks");
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ public ActionForward addSingleQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
- McQuestionContentDTO mcQuestionContentDTONew = null;
-
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- int listSize=listQuestionContentDTO.size();
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- String newQuestion=request.getParameter("newQuestion");
- String feedback=request.getParameter("feedback");
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ String totalMarks = request.getParameter("totalMarks");
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- String passmark=request.getParameter("passmark");
- mcGeneralAuthoringDTO.setPassMarkValue(passmark);
-
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
- caList=AuthoringUtil.removeBlankEntries(caList);
+ mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString());
- boolean validateSingleCorrectCandidate=authoringUtil.validateSingleCorrectCandidate(caList);
- boolean validateOnlyOneCorrectCandidate=authoringUtil.validateOnlyOneCorrectCandidate(caList);
-
- ActionMessages errors = new ActionMessages();
-
-
- if (!validateSingleCorrectCandidate)
- {
- ActionMessage error = new ActionMessage("candidates.none.correct");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
+ AuthoringUtil authoringUtil = new AuthoringUtil();
- if (!validateOnlyOneCorrectCandidate)
- {
- ActionMessage error = new ActionMessage("candidates.duplicate.correct");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ McQuestionContentDTO mcQuestionContentDTONew = null;
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
-
- if(errors.isEmpty())
- {
- if ((newQuestion != null) && (newQuestion.length() > 0))
- {
- boolean duplicates=AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
-
- if (!duplicates)
- {
- McQuestionContentDTO mcQuestionContentDTO=new McQuestionContentDTO();
- mcQuestionContentDTO.setDisplayOrder(new Long(listSize+1).toString());
- mcQuestionContentDTO.setFeedback(feedback);
- mcQuestionContentDTO.setQuestion(newQuestion);
- mcQuestionContentDTO.setMark(mark);
-
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
- mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()).toString());
-
- listQuestionContentDTO.add(mcQuestionContentDTO);
- }
- else
- {
- //entry duplicate, not adding
- }
- }
- else
- {
- //entry blank, not adding
- }
- }
- else
- {
- //errors, not adding
-
- commonSaveCode(request, mcGeneralAuthoringDTO,
- mcAuthoringForm, sessionMap, activeModule, strToolContentID,
- defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO);
+ int listSize = listQuestionContentDTO.size();
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
-
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ String newQuestion = request.getParameter("newQuestion");
+ String feedback = request.getParameter("feedback");
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ String passmark = request.getParameter("passmark");
+ mcGeneralAuthoringDTO.setPassMarkValue(passmark);
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
- return newQuestionBox(mapping, form, request, response);
- }
- mcGeneralAuthoringDTO.setMarkValue(mark);
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+ caList = AuthoringUtil.removeBlankEntries(caList);
+
+ boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList);
+ boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList);
+
+ ActionMessages errors = new ActionMessages();
+
+ if (!validateSingleCorrectCandidate) {
+ ActionMessage error = new ActionMessage("candidates.none.correct");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+ if (!validateOnlyOneCorrectCandidate) {
+ ActionMessage error = new ActionMessage("candidates.duplicate.correct");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
+
+ if (errors.isEmpty()) {
+ if ((newQuestion != null) && (newQuestion.length() > 0)) {
+ boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
+
+ if (!duplicates) {
+ McQuestionContentDTO mcQuestionContentDTO = new McQuestionContentDTO();
+ mcQuestionContentDTO.setDisplayOrder(new Long(listSize + 1).toString());
+ mcQuestionContentDTO.setFeedback(feedback);
+ mcQuestionContentDTO.setQuestion(newQuestion);
+ mcQuestionContentDTO.setMark(mark);
+
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+ mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO()
+ .size()).toString());
+
+ listQuestionContentDTO.add(mcQuestionContentDTO);
+ } else {
+ // entry duplicate, not adding
+ }
+ } else {
+ // entry blank, not adding
+ }
+ } else {
+ // errors, not adding
+
+ commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
+ defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
- mcAuthoringForm.setFeedback(feedback);
-
- mcGeneralAuthoringDTO.setMarkValue(mark);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- commonSaveCode(request, mcGeneralAuthoringDTO,
- mcAuthoringForm, sessionMap, activeModule, strToolContentID,
- defaultContentIdStr, mcService, httpSessionID,listQuestionContentDTO);
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ return newQuestionBox(mapping, form, request, response);
+ }
+ mcGeneralAuthoringDTO.setMarkValue(mark);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
- return (mapping.findForward(LOAD_MONITORING));
- }
-
-
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+ mcAuthoringForm.setFeedback(feedback);
+
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID,
+ defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
/**
* newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
*
* opens up an new screen within the current page for adding a new question
*
* newQuestionBox
+ *
* @param mapping
* @param form
* @param request
@@ -1288,114 +1105,104 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
- {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
+ public ActionForward newQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String totalMarks=request.getParameter("totalMarks");
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
-
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
-
-
- /* create default mcContent object*/
- McContent mcContent=mcService.retrieveMc(new Long(defaultContentIdStr));
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ String totalMarks = request.getParameter("totalMarks");
- AuthoringUtil authoringUtil = new AuthoringUtil();
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ /* create default mcContent object */
+ McContent mcContent = mcService.retrieveMc(new Long(defaultContentIdStr));
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- String requestType=request.getParameter("requestType");
-
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
- if ((requestType != null) && (requestType.equals("direct")))
- {
- //requestType is direct
- listAddableQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
- }
-
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
-
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return (mapping.findForward("newQuestionBox"));
- }
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ String requestType = request.getParameter("requestType");
+
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ if ((requestType != null) && (requestType.equals("direct"))) {
+ // requestType is direct
+ listAddableQuestionContentDTO = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+ }
+
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return (mapping.findForward("newQuestionBox"));
+ }
+
/**
* opens up an new screen within the current page for editing a question
*
@@ -1407,154 +1214,141 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
- {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
+ public ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String totalMarks=request.getParameter("totalMarks");
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
-
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
- request.setAttribute(CURRENT_EDITABLE_QUESTION_INDEX,questionIndex);
-
- mcAuthoringForm.setEditableQuestionIndex(questionIndex);
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ String totalMarks = request.getParameter("totalMarks");
- String editableQuestion="";
- String editableFeedback="";
- String editableMark="";
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- editableFeedback=mcQuestionContentDTO.getFeedback();
- editableQuestion=mcQuestionContentDTO.getQuestion();
- editableMark=mcQuestionContentDTO.getMark();
-
- List candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
-
- break;
- }
-
- }
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
+
+ request.setAttribute(CURRENT_EDITABLE_QUESTION_INDEX, questionIndex);
+
+ mcAuthoringForm.setEditableQuestionIndex(questionIndex);
+
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+
+ String editableQuestion = "";
+ String editableFeedback = "";
+ String editableMark = "";
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
+
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ editableFeedback = mcQuestionContentDTO.getFeedback();
+ editableQuestion = mcQuestionContentDTO.getQuestion();
+ editableMark = mcQuestionContentDTO.getMark();
+
+ List candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+
+ break;
+ }
+
}
+ }
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
- String activeModule=request.getParameter(ACTIVE_MODULE);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
-
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
-
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
-
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
- McGeneralAuthoringDTO mcGeneralAuthoringDTO = (McGeneralAuthoringDTO) request.getAttribute(MC_GENERAL_AUTHORING_DTO);
-
- if (mcGeneralAuthoringDTO == null)
- mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
-
-
- mcGeneralAuthoringDTO.setMarkValue(editableMark);
-
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
-
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
- mcGeneralAuthoringDTO.setEditableQuestionText(editableQuestion);
- mcGeneralAuthoringDTO.setEditableQuestionFeedback (editableFeedback);
- mcAuthoringForm.setFeedback(editableFeedback);
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = (McGeneralAuthoringDTO) request
+ .getAttribute(MC_GENERAL_AUTHORING_DTO);
- AuthoringUtil authoringUtil = new AuthoringUtil();
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ if (mcGeneralAuthoringDTO == null)
+ mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ mcGeneralAuthoringDTO.setMarkValue(editableMark);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- String requestNewEditableQuestionBox=(String )request.getAttribute("requestNewEditableQuestionBox");
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
- String newQuestion=request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
- if ( (requestNewEditableQuestionBox != null) && requestNewEditableQuestionBox.equals("true"))
- {
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
- }
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
-
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return (mapping.findForward("editQuestionBox"));
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setEditableQuestionText(editableQuestion);
+ mcGeneralAuthoringDTO.setEditableQuestionFeedback(editableFeedback);
+ mcAuthoringForm.setFeedback(editableFeedback);
+
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ String requestNewEditableQuestionBox = (String) request.getAttribute("requestNewEditableQuestionBox");
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ String newQuestion = request.getParameter("newQuestion");
+
+ if ((requestNewEditableQuestionBox != null) && requestNewEditableQuestionBox.equals("true")) {
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+ }
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return (mapping.findForward("editQuestionBox"));
}
-
-
/**
- removes a question from the questions map
+ * removes a question from the questions map
*
* @param mapping
* @param form
@@ -1564,132 +1358,122 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
+ public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
- String totalMarks=request.getParameter("totalMarks");
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
- McQuestionContentDTO mcQuestionContentDTO= null;
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- break;
- }
-
- }
- }
-
- mcQuestionContentDTO.setQuestion("");
-
-
- listQuestionContentDTO=AuthoringUtil.reorderListQuestionContentDTO(listQuestionContentDTO, questionIndex );
+ String totalMarks = request.getParameter("totalMarks");
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
- String activeModule=request.getParameter(ACTIVE_MODULE);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- String richTextTitle = request.getParameter(TITLE);
-
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+ McQuestionContentDTO mcQuestionContentDTO = null;
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
-
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
-
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
-
- if (mcContent == null)
- {
- mcContent=mcService.retrieveMc(new Long(defaultContentIdStr));
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ break;
}
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+ }
+ }
- AuthoringUtil authoringUtil= new AuthoringUtil();
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
+ mcQuestionContentDTO.setQuestion("");
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+ listQuestionContentDTO = AuthoringUtil.reorderListQuestionContentDTO(listQuestionContentDTO, questionIndex);
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ String richTextTitle = request.getParameter(TITLE);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return (mapping.findForward(LOAD_MONITORING));
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+
+ if (mcContent == null) {
+ mcContent = mcService.retrieveMc(new Long(defaultContentIdStr));
+ }
+
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return (mapping.findForward(LOAD_MONITORING));
}
-
-
+
/**
* moves a question down in the list
*
* moveQuestionDown
+ *
* @param mapping
* @param form
* @param request
@@ -1698,95 +1482,91 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
- String totalMarks=request.getParameter("totalMarks");
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- listQuestionContentDTO=AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "down");
-
- listQuestionContentDTO=AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ public ActionForward moveQuestionDown(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String totalMarks = request.getParameter("totalMarks");
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return (mapping.findForward(LOAD_MONITORING));
+ listQuestionContentDTO = AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "down");
+
+ listQuestionContentDTO = AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return (mapping.findForward(LOAD_MONITORING));
}
-
/**
*
* @param mapping
@@ -1797,96 +1577,89 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- listQuestionContentDTO=AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "up");
- listQuestionContentDTO=AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String totalMarks=request.getParameter("totalMarks");
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ listQuestionContentDTO = AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "up");
+ listQuestionContentDTO = AuthoringUtil.reorderSimpleListQuestionContentDTO(listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
-
- return (mapping.findForward(LOAD_MONITORING));
- }
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String totalMarks = request.getParameter("totalMarks");
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return (mapping.findForward(LOAD_MONITORING));
+ }
+
/**
* moves a candidate dwn in the list
*
@@ -1898,170 +1671,151 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
-
- String totalMarks=request.getParameter("totalMarks");
- AuthoringUtil authoringUtil = new AuthoringUtil();
- boolean validateCandidateAnswersNotBlank =authoringUtil.validateCandidateAnswersNotBlank(request);
- ActionMessages errors = new ActionMessages();
-
- if (!validateCandidateAnswersNotBlank)
- {
- ActionMessage error = new ActionMessage("candidates.blank");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
+ public ActionForward moveCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
-
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
- if (errors.isEmpty())
- {
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
- String editableQuestion="";
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- editableQuestion=mcQuestionContentDTO.getQuestion();
-
- candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
-
- listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down");
-
- mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
-
- break;
- }
-
- }
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
+
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
+
+ String totalMarks = request.getParameter("totalMarks");
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request);
+ ActionMessages errors = new ActionMessages();
+
+ if (!validateCandidateAnswersNotBlank) {
+ ActionMessage error = new ActionMessage("candidates.blank");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
+
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+
+ if (errors.isEmpty()) {
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+ String editableQuestion = "";
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
+
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ editableQuestion = mcQuestionContentDTO.getQuestion();
+
+ candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+
+ listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down");
+
+ mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
+
+ break;
}
+
+ }
}
+ }
-
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
-
- String richTextTitle = request.getParameter(TITLE);
-
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
-
-
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
-
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ String richTextTitle = request.getParameter(TITLE);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- request.setAttribute("requestNewEditableQuestionBox",new Boolean(true).toString());
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- return newEditableQuestionBox(mapping, form, request, response);
- }
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString());
+
+ return newEditableQuestionBox(mapping, form, request, response);
+ }
+
/**
*
* moves a candidate up in the list
@@ -2074,158 +1828,144 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
-
- String totalMarks=request.getParameter("totalMarks");
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
+ public ActionForward moveCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
- AuthoringUtil authoringUtil = new AuthoringUtil();
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
- boolean validateCandidateAnswersNotBlank =authoringUtil.validateCandidateAnswersNotBlank(request);
+ String totalMarks = request.getParameter("totalMarks");
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
- ActionMessages errors = new ActionMessages();
-
- if (!validateCandidateAnswersNotBlank)
- {
- ActionMessage error = new ActionMessage("candidates.blank");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
+ AuthoringUtil authoringUtil = new AuthoringUtil();
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
+ boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request);
-
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ ActionMessages errors = new ActionMessages();
-
- if (errors.isEmpty())
- {
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
- String editableQuestion="";
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- editableQuestion=mcQuestionContentDTO.getQuestion();
-
- candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
- listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up");
- mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
- mcQuestionContentDTO.setCaCount(new Integer(listCandidates.size()).toString());
-
- break;
- }
-
- }
+ if (!validateCandidateAnswersNotBlank) {
+ ActionMessage error = new ActionMessage("candidates.blank");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
+
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
+
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+
+ if (errors.isEmpty()) {
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+ String editableQuestion = "";
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
+
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ editableQuestion = mcQuestionContentDTO.getQuestion();
+
+ candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+ listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up");
+ mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
+ mcQuestionContentDTO.setCaCount(new Integer(listCandidates.size()).toString());
+
+ break;
}
+
+ }
}
-
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ }
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- request.setAttribute("requestNewEditableQuestionBox",new Boolean(true).toString());
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
- return newEditableQuestionBox(mapping, form, request, response);
- }
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString());
+
+ return newEditableQuestionBox(mapping, form, request, response);
+ }
+
/**
* removes a candidate from the list
*
@@ -2237,154 +1977,141 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
+ public ActionForward removeCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
-
- String totalMarks=request.getParameter("totalMarks");
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- AuthoringUtil authoringUtil = new AuthoringUtil();
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
-
- McQuestionContentDTO mcQuestionContentDTO= null;
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTO.getQuestion();
- String displayOrder=mcQuestionContentDTO.getDisplayOrder();
-
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- break;
- }
-
- }
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
+
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
+
+ String totalMarks = request.getParameter("totalMarks");
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+
+ McQuestionContentDTO mcQuestionContentDTO = null;
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ String question = mcQuestionContentDTO.getQuestion();
+ String displayOrder = mcQuestionContentDTO.getDisplayOrder();
+
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ break;
+ }
+
}
-
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
-
- List candidateAnswers=mcQuestionContentDTO.getListCandidateAnswersDTO();
-
- McCandidateAnswersDTO mcCandidateAnswersDTO= null;
- Iterator listCaIterator=candidateAnswers.iterator();
- int caIndex=0;
- while (listCaIterator.hasNext())
- {
- caIndex ++;
- mcCandidateAnswersDTO= (McCandidateAnswersDTO)listCaIterator.next();
-
- if (caIndex == new Integer(candidateIndex).intValue())
- {
- mcCandidateAnswersDTO.setCandidateAnswer("");
-
- break;
- }
+ }
+
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+
+ List candidateAnswers = mcQuestionContentDTO.getListCandidateAnswersDTO();
+
+ McCandidateAnswersDTO mcCandidateAnswersDTO = null;
+ Iterator listCaIterator = candidateAnswers.iterator();
+ int caIndex = 0;
+ while (listCaIterator.hasNext()) {
+ caIndex++;
+ mcCandidateAnswersDTO = (McCandidateAnswersDTO) listCaIterator.next();
+
+ if (caIndex == new Integer(candidateIndex).intValue()) {
+ mcCandidateAnswersDTO.setCandidateAnswer("");
+
+ break;
}
-
- candidateAnswers=AuthoringUtil.reorderListCandidatesDTO(candidateAnswers);
- mcQuestionContentDTO.setListCandidateAnswersDTO(candidateAnswers);
- mcQuestionContentDTO.setCaCount(new Integer(candidateAnswers.size()).toString());
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- if (mcContent == null)
- {
- mcContent=mcService.retrieveMc(new Long(defaultContentIdStr));
- }
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ }
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ candidateAnswers = AuthoringUtil.reorderListCandidatesDTO(candidateAnswers);
+ mcQuestionContentDTO.setListCandidateAnswersDTO(candidateAnswers);
+ mcQuestionContentDTO.setCaCount(new Integer(candidateAnswers.size()).toString());
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- request.setAttribute("requestNewEditableQuestionBox",new Boolean(true).toString());
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- return newEditableQuestionBox(mapping, form, request, response);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ if (mcContent == null) {
+ mcContent = mcService.retrieveMc(new Long(defaultContentIdStr));
+ }
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- }
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString());
+
+ return newEditableQuestionBox(mapping, form, request, response);
+
+ }
+
/**
*
* enables adding a new candidate answer
@@ -2397,699 +2124,630 @@
* @throws IOException
* @throws ServletException
*/
- public ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
-
- String questionIndex=request.getParameter("questionIndex");
- mcAuthoringForm.setQuestionIndex(questionIndex);
+ public ActionForward newCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String totalMarks=request.getParameter("totalMarks");
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
-
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
- AuthoringUtil authoringUtil = new AuthoringUtil();
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, true);
-
- int caCount=caList.size();
- String newQuestion=request.getParameter("newQuestion");
- String mark=request.getParameter("mark");
- String passmark=request.getParameter("passmark");
- String feedback=request.getParameter("feedback");
- int currentQuestionCount= listQuestionContentDTO.size();
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
- McQuestionContentDTO mcQuestionContentDTOLocal= null;
- Iterator listIterator=listQuestionContentDTO.iterator();
- while (listIterator.hasNext())
- {
- mcQuestionContentDTOLocal= (McQuestionContentDTO)listIterator.next();
-
- String question=mcQuestionContentDTOLocal.getQuestion();
- String displayOrder=mcQuestionContentDTOLocal.getDisplayOrder();
- if ((displayOrder != null) && (!displayOrder.equals("")))
- {
- if (displayOrder.equals(questionIndex))
- {
- break;
- }
-
- }
+ String questionIndex = request.getParameter("questionIndex");
+ mcAuthoringForm.setQuestionIndex(questionIndex);
+
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
+
+ String totalMarks = request.getParameter("totalMarks");
+
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, true);
+
+ int caCount = caList.size();
+ String newQuestion = request.getParameter("newQuestion");
+ String mark = request.getParameter("mark");
+ String passmark = request.getParameter("passmark");
+ String feedback = request.getParameter("feedback");
+ int currentQuestionCount = listQuestionContentDTO.size();
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+ McQuestionContentDTO mcQuestionContentDTOLocal = null;
+ Iterator listIterator = listQuestionContentDTO.iterator();
+ while (listIterator.hasNext()) {
+ mcQuestionContentDTOLocal = (McQuestionContentDTO) listIterator.next();
+
+ String question = mcQuestionContentDTOLocal.getQuestion();
+ String displayOrder = mcQuestionContentDTOLocal.getDisplayOrder();
+ if ((displayOrder != null) && (!displayOrder.equals(""))) {
+ if (displayOrder.equals(questionIndex)) {
+ break;
+ }
+
}
-
- if (mcQuestionContentDTOLocal != null)
- {
- mcQuestionContentDTOLocal.setListCandidateAnswersDTO(caList);
- mcQuestionContentDTOLocal.setCaCount(new Integer(caList.size()).toString());
- }
-
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ }
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+ if (mcQuestionContentDTOLocal != null) {
+ mcQuestionContentDTOLocal.setListCandidateAnswersDTO(caList);
+ mcQuestionContentDTOLocal.setCaCount(new Integer(caList.size()).toString());
+ }
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- mcAuthoringForm.setFeedback(feedback);
-
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- request.setAttribute("requestNewEditableQuestionBox",new Boolean(true).toString());
-
- return newEditableQuestionBox(mapping, form, request, response);
- }
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- public ActionForward moveAddedCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
-
-
- String totalMarks=request.getParameter("totalMarks");
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
+ request.getSession().setAttribute(httpSessionID, sessionMap);
- AuthoringUtil authoringUtil = new AuthoringUtil();
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
- boolean validateCandidateAnswersNotBlank =authoringUtil.validateCandidateAnswersNotBlank(request);
- ActionMessages errors = new ActionMessages();
-
- if (!validateCandidateAnswersNotBlank)
- {
- ActionMessage error = new ActionMessage("candidates.blank");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
-
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
- if (errors.isEmpty())
- {
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
-
- Iterator listIterator=listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
- listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up");
-
- mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
- }
- }
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
-
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ mcAuthoringForm.setFeedback(feedback);
-
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ mcGeneralAuthoringDTO.setMarkValue(mark);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
-
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- return newQuestionBox(mapping, form, request, response);
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString());
+
+ return newEditableQuestionBox(mapping, form, request, response);
}
-
-
- public ActionForward moveAddedCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
-
- String totalMarks=request.getParameter("totalMarks");
- AuthoringUtil authoringUtil = new AuthoringUtil();
- boolean validateCandidateAnswersNotBlank =authoringUtil.validateCandidateAnswersNotBlank(request);
- ActionMessages errors = new ActionMessages();
-
- if (!validateCandidateAnswersNotBlank)
- {
- ActionMessage error = new ActionMessage("candidates.blank");
- errors.add(ActionMessages.GLOBAL_MESSAGE, error);
- }
-
+ public ActionForward moveAddedCandidateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- if(!errors.isEmpty()){
- saveErrors(request, errors);
- logger.debug("errors saved: " + errors);
- }
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ String totalMarks = request.getParameter("totalMarks");
-
- if (errors.isEmpty())
- {
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
-
- Iterator listIterator=listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
- listCandidates=AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down");
- mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
- }
- }
-
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
-
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ AuthoringUtil authoringUtil = new AuthoringUtil();
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request);
+ ActionMessages errors = new ActionMessages();
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ if (!validateCandidateAnswersNotBlank) {
+ ActionMessage error = new ActionMessage("candidates.blank");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
- return newQuestionBox(mapping, form, request, response);
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ if (errors.isEmpty()) {
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+
+ Iterator listIterator = listAddableQuestionContentDTO.iterator();
+ /* there is only 1 question dto */
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+ listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up");
+
+ mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
+ }
+ }
+
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return newQuestionBox(mapping, form, request, response);
+
}
-
-
- public ActionForward removeAddedCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
-
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
-
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
-
+ public ActionForward moveAddedCandidateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
-
- String totalMarks=request.getParameter("totalMarks");
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
- AuthoringUtil authoringUtil = new AuthoringUtil();
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, false);
+ String totalMarks = request.getParameter("totalMarks");
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request);
+ ActionMessages errors = new ActionMessages();
-
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+ if (!validateCandidateAnswersNotBlank) {
+ ActionMessage error = new ActionMessage("candidates.blank");
+ errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ }
-
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ logger.debug("errors saved: " + errors);
+ }
-
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
-
- Iterator listIterator=listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
-
- candidates=mcQuestionContentDTO.getListCandidateAnswersDTO();
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
-
- List candidateAnswers=mcQuestionContentDTO.getListCandidateAnswersDTO();
- McCandidateAnswersDTO mcCandidateAnswersDTO= null;
- Iterator listCaIterator=candidateAnswers.iterator();
- int caIndex=0;
- while (listCaIterator.hasNext())
- {
- caIndex ++;
- mcCandidateAnswersDTO= (McCandidateAnswersDTO)listCaIterator.next();
- if (caIndex == new Integer(candidateIndex).intValue())
- {
- mcCandidateAnswersDTO.setCandidateAnswer("");
- break;
- }
- }
-
- candidateAnswers=AuthoringUtil.reorderListCandidatesDTO(candidateAnswers);
- mcQuestionContentDTO.setListCandidateAnswersDTO(candidateAnswers);
- mcQuestionContentDTO.setCaCount(new Integer(candidateAnswers.size()).toString());
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+
+ if (errors.isEmpty()) {
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+
+ Iterator listIterator = listAddableQuestionContentDTO.iterator();
+ /* there is only 1 question dto */
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+ listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down");
+ mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates);
}
+ }
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- if (mcContent == null)
- {
- mcContent=mcService.retrieveMc(new Long(defaultContentIdStr));
- }
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
-
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- String newQuestion=request.getParameter("newQuestion");
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
-
- String feedback=request.getParameter("feedback");
- mcAuthoringForm.setFeedback(feedback);
-
- String mark=request.getParameter("mark");
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
-
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return newQuestionBox(mapping, form, request, response);
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+
+ return newQuestionBox(mapping, form, request, response);
}
+ public ActionForward removeAddedCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
- public ActionForward newAddedCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException {
- McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
-
- IMcService mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- String httpSessionID=mcAuthoringForm.getHttpSessionID();
- SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID);
- String candidateIndex=request.getParameter("candidateIndex");
- mcAuthoringForm.setCandidateIndex(candidateIndex);
- String totalMarks=request.getParameter("totalMarks");
- List listQuestionContentDTO=(List)sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
- AuthoringUtil authoringUtil = new AuthoringUtil();
- List caList=authoringUtil.repopulateCandidateAnswersBox(request, true);
- int caCount=caList.size();
- String newQuestion=request.getParameter("newQuestion");
- String mark=request.getParameter("mark");
- String passmark=request.getParameter("passmark");
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
-
- String feedback=request.getParameter("feedback");
- int currentQuestionCount= listQuestionContentDTO.size();
- String editQuestionBoxRequest=request.getParameter("editQuestionBoxRequest");
- List listAddableQuestionContentDTO = (List)sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
- List candidates =new LinkedList();
- List listCandidates =new LinkedList();
-
- Iterator listIterator=listAddableQuestionContentDTO.iterator();
- /*there is only 1 question dto*/
- while (listIterator.hasNext())
- {
- McQuestionContentDTO mcQuestionContentDTO= (McQuestionContentDTO)listIterator.next();
- mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
- mcQuestionContentDTO.setCaCount(new Integer(caList.size()).toString());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
+
+ String totalMarks = request.getParameter("totalMarks");
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, false);
+
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+
+ Iterator listIterator = listAddableQuestionContentDTO.iterator();
+ /* there is only 1 question dto */
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+
+ candidates = mcQuestionContentDTO.getListCandidateAnswersDTO();
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+
+ List candidateAnswers = mcQuestionContentDTO.getListCandidateAnswersDTO();
+ McCandidateAnswersDTO mcCandidateAnswersDTO = null;
+ Iterator listCaIterator = candidateAnswers.iterator();
+ int caIndex = 0;
+ while (listCaIterator.hasNext()) {
+ caIndex++;
+ mcCandidateAnswersDTO = (McCandidateAnswersDTO) listCaIterator.next();
+ if (caIndex == new Integer(candidateIndex).intValue()) {
+ mcCandidateAnswersDTO.setCandidateAnswer("");
+ break;
+ }
}
-
- request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
-
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- String richTextTitle = request.getParameter(TITLE);
- String richTextInstructions = request.getParameter(INSTRUCTIONS);
- sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
-
- String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- String defaultContentIdStr=new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();;
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
- mcAuthoringForm.setTitle(richTextTitle);
-
- mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
-
- mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
-
- request.getSession().setAttribute(httpSessionID, sessionMap);
-
- McUtils.setFormProperties(request, mcService,
- mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
-
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
- mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
- mcGeneralAuthoringDTO.setActiveModule(activeModule);
- mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setToolContentID(strToolContentID);
- mcAuthoringForm.setHttpSessionID(httpSessionID);
- mcAuthoringForm.setActiveModule(activeModule);
- mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
- mcAuthoringForm.setCurrentTab("3");
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
-
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ candidateAnswers = AuthoringUtil.reorderListCandidatesDTO(candidateAnswers);
+ mcQuestionContentDTO.setListCandidateAnswersDTO(candidateAnswers);
+ mcQuestionContentDTO.setCaCount(new Integer(candidateAnswers.size()).toString());
+ }
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTO);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
- mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
- mcAuthoringForm.setFeedback(feedback);
- mcGeneralAuthoringDTO.setMarkValue(mark);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- McContent mcContent=mcService.retrieveMc(new Long(strToolContentID));
- setupCommonScreenData(mcContent, mcService,request);
-
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- return newQuestionBox(mapping, form, request, response);
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ if (mcContent == null) {
+ mcContent = mcService.retrieveMc(new Long(defaultContentIdStr));
+ }
+
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ String newQuestion = request.getParameter("newQuestion");
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+
+ String feedback = request.getParameter("feedback");
+ mcAuthoringForm.setFeedback(feedback);
+
+ String mark = request.getParameter("mark");
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return newQuestionBox(mapping, form, request, response);
+
}
-
+
+ public ActionForward newAddedCandidateBox(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ McAuthoringForm mcAuthoringForm = (McMonitoringForm) form;
+
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String httpSessionID = mcAuthoringForm.getHttpSessionID();
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID);
+ String candidateIndex = request.getParameter("candidateIndex");
+ mcAuthoringForm.setCandidateIndex(candidateIndex);
+ String totalMarks = request.getParameter("totalMarks");
+ List listQuestionContentDTO = (List) sessionMap.get(LIST_QUESTION_CONTENT_DTO_KEY);
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List caList = authoringUtil.repopulateCandidateAnswersBox(request, true);
+ int caCount = caList.size();
+ String newQuestion = request.getParameter("newQuestion");
+ String mark = request.getParameter("mark");
+ String passmark = request.getParameter("passmark");
+
+ String feedback = request.getParameter("feedback");
+ int currentQuestionCount = listQuestionContentDTO.size();
+ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest");
+ List listAddableQuestionContentDTO = (List) sessionMap.get(NEW_ADDABLE_QUESTION_CONTENT_KEY);
+ List candidates = new LinkedList();
+ List listCandidates = new LinkedList();
+
+ Iterator listIterator = listAddableQuestionContentDTO.iterator();
+ /* there is only 1 question dto */
+ while (listIterator.hasNext()) {
+ McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next();
+ mcQuestionContentDTO.setListCandidateAnswersDTO(caList);
+ mcQuestionContentDTO.setCaCount(new Integer(caList.size()).toString());
+ }
+
+ request.setAttribute(NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
+
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ String richTextTitle = request.getParameter(TITLE);
+ String richTextInstructions = request.getParameter(INSTRUCTIONS);
+ sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle);
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
+
+ String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE)).toString();
+ ;
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ mcGeneralAuthoringDTO.setActivityTitle(richTextTitle);
+ mcAuthoringForm.setTitle(richTextTitle);
+
+ mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions);
+
+ mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString());
+
+ request.getSession().setAttribute(httpSessionID, sessionMap);
+
+ McUtils.setFormProperties(request, mcService, mcAuthoringForm, mcGeneralAuthoringDTO, strToolContentID,
+ defaultContentIdStr, activeModule, sessionMap, httpSessionID);
+
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+ mcGeneralAuthoringDTO.setActiveModule(activeModule);
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+ mcAuthoringForm.setHttpSessionID(httpSessionID);
+ mcAuthoringForm.setActiveModule(activeModule);
+ mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr);
+ mcAuthoringForm.setCurrentTab("3");
+
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
+
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion);
+ mcAuthoringForm.setFeedback(feedback);
+ mcGeneralAuthoringDTO.setMarkValue(mark);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ McContent mcContent = mcService.retrieveMc(new Long(strToolContentID));
+ setupCommonScreenData(mcContent, mcService, request);
+
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ return newQuestionBox(mapping, form, request, response);
+ }
+
/**
* prepares reflection data
*
@@ -3099,144 +2757,124 @@
* @param userID
* @param exportMode
*/
- public void prepareReflectionData(HttpServletRequest request, McContent mcContent,
- IMcService mcService, String userID, boolean exportMode)
- {
- List reflectionsContainerDTO= new LinkedList();
-
- if (userID == null)
- {
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
+ public void prepareReflectionData(HttpServletRequest request, McContent mcContent, IMcService mcService,
+ String userID, boolean exportMode) {
+ List reflectionsContainerDTO = new LinkedList();
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
-
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getUsername());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
-
- }
- }
+ if (userID == null) {
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getUsername());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+
+ }
}
- else
- {
- //single user mode
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
- if (user.getQueUsrId().toString().equals(userID))
- {
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
-
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getUsername());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
-
- }
- }
- }
-
+ } else {
+ // single user mode
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+ if (user.getQueUsrId().toString().equals(userID)) {
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getUsername());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+
+ }
+ }
}
-
- request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
-
- if (exportMode)
- {
- request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
- }
+
}
+ request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
- /**
- * allows viewing users reflection data
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- * @throws ToolException
- */
- public ActionForward openNotebook(ActionMapping mapping,
- ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException, ToolException
- {
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String uid=request.getParameter("uid");
- String userId=request.getParameter("userId");
- String userName=request.getParameter("userName");
- String sessionId=request.getParameter("sessionId");
- NotebookEntry notebookEntry = mcService.getEntry(new Long(sessionId),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(userId));
-
- McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO= new McGeneralLearnerFlowDTO();
- if (notebookEntry != null) {
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- mcGeneralLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable);
- mcGeneralLearnerFlowDTO.setUserName(userName);
- }
+ if (exportMode) {
+ request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
+ }
+ }
- request.setAttribute(MC_GENERAL_LEARNER_FLOW_DTO, mcGeneralLearnerFlowDTO);
-
- return mapping.findForward(LEARNER_NOTEBOOK);
+ /**
+ * allows viewing users reflection data
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws ToolException
+ */
+ public ActionForward openNotebook(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, ToolException {
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String uid = request.getParameter("uid");
+ String userId = request.getParameter("userId");
+ String userName = request.getParameter("userName");
+ String sessionId = request.getParameter("sessionId");
+ NotebookEntry notebookEntry = mcService.getEntry(new Long(sessionId), CoreNotebookConstants.NOTEBOOK_TOOL,
+ MY_SIGNATURE, new Integer(userId));
+
+ McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO = new McGeneralLearnerFlowDTO();
+ if (notebookEntry != null) {
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ mcGeneralLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable);
+ mcGeneralLearnerFlowDTO.setUserName(userName);
}
-
-
- /**
- *
- * @param request
- * @param mcContent
- * @param mcService
- * @param userID
- * @param exportMode
- * @param currentSessionId
- */
- public void prepareReflectionData(HttpServletRequest request, McContent mcContent,
- IMcService mcService, String userID, boolean exportMode, String currentSessionId)
- {
+ request.setAttribute(MC_GENERAL_LEARNER_FLOW_DTO, mcGeneralLearnerFlowDTO);
- List reflectionsContainerDTO= new LinkedList();
-
- reflectionsContainerDTO=getReflectionList(mcContent, userID, mcService);
-
- request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
-
- if (exportMode)
- {
- request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
- }
+ return mapping.findForward(LEARNER_NOTEBOOK);
+ }
+
+ /**
+ *
+ * @param request
+ * @param mcContent
+ * @param mcService
+ * @param userID
+ * @param exportMode
+ * @param currentSessionId
+ */
+ public void prepareReflectionData(HttpServletRequest request, McContent mcContent, IMcService mcService,
+ String userID, boolean exportMode, String currentSessionId) {
+
+ List reflectionsContainerDTO = new LinkedList();
+
+ reflectionsContainerDTO = getReflectionList(mcContent, userID, mcService);
+
+ request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
+
+ if (exportMode) {
+ request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO);
}
-
+ }
/**
*
@@ -3247,70 +2885,61 @@
* @param mcService
* @return
*/
- public List getReflectionList(McContent mcContent, String userID, IMcService mcService)
- {
- List reflectionsContainerDTO= new LinkedList();
- if (userID == null)
- {
- //all users mode
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
-
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
+ public List getReflectionList(McContent mcContent, String userID, IMcService mcService) {
+ List reflectionsContainerDTO = new LinkedList();
+ if (userID == null) {
+ // all users mode
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
-
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getFullname());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
- }
- }
- }
- else
- {
- //single user mode
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
- if (user.getQueUsrId().toString().equals(userID))
- {
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
-
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getFullname());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
- }
- }
- }
- }
-
- return reflectionsContainerDTO;
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getFullname());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+ }
+ }
+ } else {
+ // single user mode
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+ if (user.getQueUsrId().toString().equals(userID)) {
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getFullname());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+ }
+ }
+ }
+ }
+
+ return reflectionsContainerDTO;
}
-
+
/**
* returns reflection data for a specific session
*
@@ -3320,364 +2949,337 @@
* @param currentSessionId
* @return
*/
- public List getReflectionListForSession(McContent mcContent, String userID, IMcService mcService, String currentSessionId)
- {
- List reflectionsContainerDTO= new LinkedList();
- if (userID == null)
- {
- //all users mode
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
-
- if (currentSessionId.equals(mcSession.getMcSessionId()))
- {
-
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
+ public List getReflectionListForSession(McContent mcContent, String userID, IMcService mcService,
+ String currentSessionId) {
+ List reflectionsContainerDTO = new LinkedList();
+ if (userID == null) {
+ // all users mode
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
-
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getFullname());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
- }
- }
- }
- }
- else
- {
- //single user mode
- for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();)
- {
- McSession mcSession = (McSession) sessionIter.next();
-
- if (currentSessionId.equals(mcSession.getMcSessionId()))
- {
- for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();)
- {
- McQueUsr user = (McQueUsr) userIter.next();
- if (user.getQueUsrId().toString().equals(userID))
- {
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(user.getQueUsrId().toString()));
- if (notebookEntry != null) {
- ReflectionDTO reflectionDTO = new ReflectionDTO();
- reflectionDTO.setUserId(user.getQueUsrId().toString());
- reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
- reflectionDTO.setUserName(user.getFullname());
- reflectionDTO.setReflectionUid (notebookEntry.getUid().toString());
- String notebookEntryPresentable=McUtils.replaceNewLines(notebookEntry.getEntry());
- reflectionDTO.setEntry(notebookEntryPresentable);
- reflectionsContainerDTO.add(reflectionDTO);
- }
- }
- }
-
- }
- }
- }
-
- return reflectionsContainerDTO;
- }
+ if (currentSessionId.equals(mcSession.getMcSessionId())) {
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getFullname());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+ }
+ }
+ }
+ } else {
+ // single user mode
+ for (Iterator sessionIter = mcContent.getMcSessions().iterator(); sessionIter.hasNext();) {
+ McSession mcSession = (McSession) sessionIter.next();
+
+ if (currentSessionId.equals(mcSession.getMcSessionId())) {
+ for (Iterator userIter = mcSession.getMcQueUsers().iterator(); userIter.hasNext();) {
+ McQueUsr user = (McQueUsr) userIter.next();
+ if (user.getQueUsrId().toString().equals(userID)) {
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(user.getQueUsrId()
+ .toString()));
+ if (notebookEntry != null) {
+ ReflectionDTO reflectionDTO = new ReflectionDTO();
+ reflectionDTO.setUserId(user.getQueUsrId().toString());
+ reflectionDTO.setSessionId(mcSession.getMcSessionId().toString());
+ reflectionDTO.setUserName(user.getFullname());
+ reflectionDTO.setReflectionUid(notebookEntry.getUid().toString());
+ String notebookEntryPresentable = McUtils.replaceNewLines(notebookEntry.getEntry());
+ reflectionDTO.setEntry(notebookEntryPresentable);
+ reflectionsContainerDTO.add(reflectionDTO);
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+ return reflectionsContainerDTO;
+ }
+
/**
* prepareEditActivityScreenData
*
* @param request
* @param mcContent
*/
- public void prepareEditActivityScreenData(HttpServletRequest request, McContent mcContent)
- {
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
-
- mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
- mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
- }
+ public void prepareEditActivityScreenData(HttpServletRequest request, McContent mcContent) {
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
- /**
- *
- * @param request
- * @param mcMonitoringForm
- * @param mcGeneralMonitoringDTO
- */
- protected void repopulateRequestParameters(HttpServletRequest request, McMonitoringForm mcMonitoringForm,
- McGeneralMonitoringDTO mcGeneralMonitoringDTO)
- {
-
- String toolContentID=request.getParameter(TOOL_CONTENT_ID);
- mcMonitoringForm.setToolContentID(toolContentID);
- mcGeneralMonitoringDTO.setToolContentID(toolContentID);
-
- String activeModule=request.getParameter(ACTIVE_MODULE);
- mcMonitoringForm.setActiveModule(activeModule);
- mcGeneralMonitoringDTO.setActiveModule(activeModule);
-
- String defineLaterInEditMode=request.getParameter(DEFINE_LATER_IN_EDIT_MODE);
- mcMonitoringForm.setDefineLaterInEditMode(defineLaterInEditMode);
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(defineLaterInEditMode);
+ mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
+ mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+ }
-
- String isToolSessionChanged=request.getParameter(IS_TOOL_SESSION_CHANGED);
- mcMonitoringForm.setIsToolSessionChanged(isToolSessionChanged);
- mcGeneralMonitoringDTO.setIsToolSessionChanged(isToolSessionChanged);
+ /**
+ *
+ * @param request
+ * @param mcMonitoringForm
+ * @param mcGeneralMonitoringDTO
+ */
+ protected void repopulateRequestParameters(HttpServletRequest request, McMonitoringForm mcMonitoringForm,
+ McGeneralMonitoringDTO mcGeneralMonitoringDTO) {
- String responseId=request.getParameter(RESPONSE_ID);
- mcMonitoringForm.setResponseId(responseId);
- mcGeneralMonitoringDTO.setResponseId(responseId);
+ String toolContentID = request.getParameter(TOOL_CONTENT_ID);
+ mcMonitoringForm.setToolContentID(toolContentID);
+ mcGeneralMonitoringDTO.setToolContentID(toolContentID);
- String currentUid=request.getParameter(CURRENT_UID);
- mcMonitoringForm.setCurrentUid(currentUid);
- mcGeneralMonitoringDTO.setCurrentUid(currentUid);
+ String activeModule = request.getParameter(ACTIVE_MODULE);
+ mcMonitoringForm.setActiveModule(activeModule);
+ mcGeneralMonitoringDTO.setActiveModule(activeModule);
+
+ String defineLaterInEditMode = request.getParameter(DEFINE_LATER_IN_EDIT_MODE);
+ mcMonitoringForm.setDefineLaterInEditMode(defineLaterInEditMode);
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(defineLaterInEditMode);
+
+ String isToolSessionChanged = request.getParameter(IS_TOOL_SESSION_CHANGED);
+ mcMonitoringForm.setIsToolSessionChanged(isToolSessionChanged);
+ mcGeneralMonitoringDTO.setIsToolSessionChanged(isToolSessionChanged);
+
+ String responseId = request.getParameter(RESPONSE_ID);
+ mcMonitoringForm.setResponseId(responseId);
+ mcGeneralMonitoringDTO.setResponseId(responseId);
+
+ String currentUid = request.getParameter(CURRENT_UID);
+ mcMonitoringForm.setCurrentUid(currentUid);
+ mcGeneralMonitoringDTO.setCurrentUid(currentUid);
}
-
/**
*
* @param mcContent
* @param mcService
* @param request
*/
- protected void setupCommonScreenData(McContent mcContent, IMcService mcService, HttpServletRequest request)
- {
- /*setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */
- McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO();
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
-
- if (mcService.studentActivityOccurredGlobal(mcContent))
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
- }
- else
- {
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
- }
-
-
- mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
-
- List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
- mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
- mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
-
+ protected void setupCommonScreenData(McContent mcContent, IMcService mcService, HttpServletRequest request) {
+ /* setting up USER_EXCEPTION_NO_TOOL_SESSIONS, from here */
+ McGeneralMonitoringDTO mcGeneralMonitoringDTO = new McGeneralMonitoringDTO();
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
- /*.. till here*/
-
-
- /*find out if there are any reflection entries, from here*/
- boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent);
-
- if (notebookEntriesExist)
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
-
- String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
-
- if (userExceptionNoToolSessions.equals("true"))
- {
- //there are no online student activity but there are reflections
- request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
- }
- }
- else
- {
- request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
- }
- /* ... till here*/
+ if (mcService.studentActivityOccurredGlobal(mcContent)) {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString());
+ } else {
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
+ }
- MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
- MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
+ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
+
+ List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
+ mcGeneralMonitoringDTO.setAttachmentList(attachmentList);
+ mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList());
+
+ request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
+ /* .. till here */
+
+ /* find out if there are any reflection entries, from here */
+ boolean notebookEntriesExist = MonitoringUtil.notebookEntriesExist(mcService, mcContent);
+
+ if (notebookEntriesExist) {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+
+ String userExceptionNoToolSessions = (String) mcGeneralMonitoringDTO.getUserExceptionNoToolSessions();
+
+ if (userExceptionNoToolSessions.equals("true")) {
+ // there are no online student activity but there are reflections
+ request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString());
+ }
+ } else {
+ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString());
+ }
+ /* ... till here */
+
+ MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO);
+ MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent);
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
}
-
-
-
+
/**
- * downloadMarks
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- */
- public ActionForward downloadMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
- {
- MessageService messageService = getMessageService();
-
- String currentMonitoredToolSession=request.getParameter("monitoredToolSessionId");
- McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
-
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- String toolContentID = mcMonitoringForm.getToolContentID();
-
- McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
-
- byte[] spreadsheet = null;
-
- try {
- spreadsheet = prepareSessionDataSpreadsheet(request, response, mcContent, mcService, messageService, currentMonitoredToolSession);
- } catch (Exception e) {
- log.error("Error preparing spreadsheet: ", e);
- request.setAttribute("errorName", messageService.getMessage("error.monitoring.spreadsheet.download"));
- request.setAttribute("errorMessage", e);
- return mapping.findForward("error");
+ * downloadMarks
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward downloadMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException {
+ MessageService messageService = getMessageService();
+
+ String currentMonitoredToolSession = request.getParameter("monitoredToolSessionId");
+ McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
+
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ String toolContentID = mcMonitoringForm.getToolContentID();
+
+ McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
+
+ byte[] spreadsheet = null;
+
+ try {
+ spreadsheet = prepareSessionDataSpreadsheet(request, response, mcContent, mcService, messageService,
+ currentMonitoredToolSession);
+ } catch (Exception e) {
+ log.error("Error preparing spreadsheet: ", e);
+ request.setAttribute("errorName", messageService.getMessage("error.monitoring.spreadsheet.download"));
+ request.setAttribute("errorMessage", e);
+ return mapping.findForward("error");
+ }
+
+ // construct download file response header
+ OutputStream out = response.getOutputStream();
+ String fileName = "lams_mcq_" + currentMonitoredToolSession + ".xls";
+ String mineType = "application/vnd.ms-excel";
+ String header = "attachment; filename=\"" + fileName + "\";";
+ response.setContentType(mineType);
+ response.setHeader("Content-Disposition", header);
+
+ // write response
+ try {
+ out.write(spreadsheet);
+ out.flush();
+ } finally {
+ try {
+ if (out != null)
+ out.close();
+ } catch (IOException e) {
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * prepareSessionDataSpreadsheet
+ *
+ * @param request
+ * @param response
+ * @param mcContent
+ * @param mcService
+ * @param currentMonitoredToolSession
+ *
+ * @return data to write out
+ */
+ public byte[] prepareSessionDataSpreadsheet(HttpServletRequest request, HttpServletResponse response,
+ McContent mcContent, IMcService mcService, MessageService messageService, String currentMonitoredToolSession)
+ throws IOException, ServletException {
+ // create an empty excel file
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet("Marks");
+
+ HSSFRow row;
+ HSSFCell cell;
+
+ List listMonitoredAnswersContainerDTO = MonitoringUtil.buildGroupsQuestionData(request, mcContent, mcService);
+ List listMonitoredMarksContainerDTO = MonitoringUtil.buildGroupsMarkData(request, mcContent, mcService);
+
+ Map mapOptionsContent = new TreeMap(new McComparator());
+ mapOptionsContent.clear();
+
+ Iterator queIterator = mcContent.getMcQueContents().iterator();
+ Long mapIndex = new Long(1);
+
+ int idx = 0;
+
+ Iterator marksIterator = listMonitoredMarksContainerDTO.iterator();
+
+ while (marksIterator.hasNext()) {
+
+ McSessionMarkDTO mcSessionMarkDTO = (McSessionMarkDTO) marksIterator.next();
+ Map usersMarksMap = mcSessionMarkDTO.getUserMarks();
+
+ String currentSessionId = mcSessionMarkDTO.getSessionId();
+ String currentSessionName = mcSessionMarkDTO.getSessionName();
+
+ if (currentMonitoredToolSession.equals("All") || currentMonitoredToolSession.equals(currentSessionId)) {
+
+ row = sheet.createRow(idx++);
+
+ cell = row.createCell(0);
+ cell.setCellValue(messageService.getMessage("group.label"));
+
+ cell = row.createCell(1);
+ cell.setCellValue(currentSessionName);
+
+ idx++;
+ int count = 0;
+
+ row = sheet.createRow(idx++);
+
+ cell = row.createCell(count++);
+ cell.setCellValue(messageService.getMessage("label.learner"));
+
+ cell = row.createCell(count++);
+ cell.setCellValue(messageService.getMessage("label.monitoring.downloadMarks.username"));
+
+ Iterator answersIterator = listMonitoredAnswersContainerDTO.iterator();
+
+ while (answersIterator.hasNext()) {
+ McMonitoredAnswersDTO mcMonitoredAnswersDTO = (McMonitoredAnswersDTO) answersIterator.next();
+
+ cell = row.createCell(count++);
+ cell.setCellValue(messageService.getMessage("label.monitoring.downloadMarks.question.mark",
+ new Object[] { count - 1, mcMonitoredAnswersDTO.getMark() }));
}
-
- // construct download file response header
- OutputStream out = response.getOutputStream();
- String fileName = "lams_mcq_" + currentMonitoredToolSession+".xls";
- String mineType = "application/vnd.ms-excel";
- String header = "attachment; filename=\"" + fileName + "\";";
- response.setContentType(mineType);
- response.setHeader("Content-Disposition",header);
-
- // write response
- try {
- out.write(spreadsheet);
- out.flush();
- } finally {
- try {
- if (out != null) out.close();
- } catch (IOException e) {}
+
+ cell = row.createCell(count++);
+ cell.setCellValue(messageService.getMessage("label.total"));
+
+ Iterator userMarkIterator = usersMarksMap.values().iterator();
+
+ while (userMarkIterator.hasNext()) {
+ row = sheet.createRow(idx++);
+ count = 0;
+
+ McUserMarkDTO userMark = (McUserMarkDTO) userMarkIterator.next();
+ String currentUserSessionId = userMark.getSessionId();
+
+ cell = row.createCell(count++);
+ cell.setCellValue(userMark.getFullName());
+
+ cell = row.createCell(count++);
+ cell.setCellValue(userMark.getUserName());
+
+ Integer[] marks = userMark.getMarks();
+ for (int i = 0; i < marks.length; i++) {
+ cell = row.createCell(count++);
+ cell.setCellValue(marks[i]);
+ }
+
+ cell = row.createCell(count++);
+ cell.setCellValue(userMark.getTotalMark());
}
-
- return null;
- }
-
- /**
- * prepareSessionDataSpreadsheet
- *
- * @param request
- * @param response
- * @param mcContent
- * @param mcService
- * @param currentMonitoredToolSession
- *
- * @return data to write out
- */
- public byte[] prepareSessionDataSpreadsheet(HttpServletRequest request, HttpServletResponse response, McContent mcContent,
- IMcService mcService, MessageService messageService, String currentMonitoredToolSession)
- throws IOException, ServletException
- {
- //create an empty excel file
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet sheet = wb.createSheet("Marks");
-
- HSSFRow row;
- HSSFCell cell;
-
- List listMonitoredAnswersContainerDTO=MonitoringUtil.buildGroupsQuestionData(request, mcContent, mcService);
- List listMonitoredMarksContainerDTO=MonitoringUtil.buildGroupsMarkData(request, mcContent, mcService);
-
- Map mapOptionsContent= new TreeMap(new McComparator());
- mapOptionsContent.clear();
-
- Iterator queIterator= mcContent.getMcQueContents().iterator();
- Long mapIndex=new Long(1);
-
- int idx = 0;
- Iterator marksIterator = listMonitoredMarksContainerDTO.iterator();
-
- while(marksIterator.hasNext()) {
-
- McSessionMarkDTO mcSessionMarkDTO = (McSessionMarkDTO) marksIterator.next();
- Map usersMarksMap = mcSessionMarkDTO.getUserMarks();
-
- String currentSessionId = mcSessionMarkDTO.getSessionId();
- String currentSessionName = mcSessionMarkDTO.getSessionName();
-
- if(currentMonitoredToolSession.equals("All") || currentMonitoredToolSession.equals(currentSessionId)) {
-
- row = sheet.createRow(idx++);
-
- cell = row.createCell(0);
- cell.setCellValue(messageService.getMessage("group.label"));
-
- cell = row.createCell(1);
- cell.setCellValue(currentSessionName);
-
- idx++;
- int count = 0;
-
- row = sheet.createRow(idx++);
-
- cell = row.createCell(count++);
- cell.setCellValue(messageService.getMessage("label.learner"));
-
- cell = row.createCell(count++);
- cell.setCellValue(messageService.getMessage("label.monitoring.downloadMarks.username"));
-
- Iterator answersIterator = listMonitoredAnswersContainerDTO.iterator();
-
- while(answersIterator.hasNext()) {
- McMonitoredAnswersDTO mcMonitoredAnswersDTO = (McMonitoredAnswersDTO) answersIterator.next();
-
- cell = row.createCell(count++);
- cell.setCellValue(messageService.getMessage("label.monitoring.downloadMarks.question.mark", new Object[] {count-1, mcMonitoredAnswersDTO.getMark()}));
- }
-
- cell = row.createCell(count++);
- cell.setCellValue(messageService.getMessage("label.total"));
-
- Iterator userMarkIterator = usersMarksMap.values().iterator();
-
- while(userMarkIterator.hasNext()) {
- row = sheet.createRow(idx++);
- count = 0;
-
- McUserMarkDTO userMark = (McUserMarkDTO) userMarkIterator.next();
- String currentUserSessionId = userMark.getSessionId();
+ idx++;
+ }
- cell = row.createCell(count++);
- cell.setCellValue(userMark.getFullName());
-
- cell = row.createCell(count++);
- cell.setCellValue(userMark.getUserName());
-
-
- Integer[] marks = userMark.getMarks();
- for(int i=0; i Starts up the monitoring module
+ *
+ * Starts up the monitoring module
+ *
*
* @author Ozgur Demirtas
*
-
-
-
-
-
-
-
-
-
-
-
*
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
*/
public class McMonitoringStarterAction extends Action implements McAppConstants {
- static Logger logger = Logger.getLogger(McMonitoringStarterAction.class.getName());
+ static Logger logger = Logger.getLogger(McMonitoringStarterAction.class.getName());
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException, McApplicationException
- {
- McUtils.cleanUpSessionAbsolute(request);
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, McApplicationException {
+ McUtils.cleanUpSessionAbsolute(request);
- IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
- McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- McGeneralMonitoringDTO mcGeneralMonitoringDTO=new McGeneralMonitoringDTO();
-
- String toolContentID = null;
- try {
- Long toolContentIDLong = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID, false);
- toolContentID = toolContentIDLong.toString();
- mcMonitoringForm.setToolContentId(toolContentID);
- mcMonitoringForm.setToolContentID(toolContentID);
- } catch ( IllegalArgumentException e ) {
- logger.error("Unable to start monitoring as tool content id is missing");
- McUtils.cleanUpSessionAbsolute(request);
- throw (e);
- }
+ IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ McGeneralMonitoringDTO mcGeneralMonitoringDTO = new McGeneralMonitoringDTO();
- initialiseMonitoringData(mapping, form, request, response,
- mcService, mcGeneralMonitoringDTO);
-
- mcMonitoringForm.setCurrentTab("1");
- mcGeneralMonitoringDTO.setCurrentTab("1");
-
- mcMonitoringForm.setActiveModule(MONITORING);
- mcGeneralMonitoringDTO.setActiveModule(MONITORING);
-
- mcMonitoringForm.setSelectedToolSessionId("All");
- mcGeneralMonitoringDTO.setSelectedToolSessionId("All");
-
- mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setIsPortfolioExport(new Boolean(false).toString());
-
- /*this section is needed for Edit Activity screen, from here... */
- mcGeneralAuthoringDTO.setActivityTitle(mcGeneralMonitoringDTO.getActivityTitle());
- mcGeneralAuthoringDTO.setActivityInstructions(mcGeneralMonitoringDTO.getActivityInstructions());
- mcGeneralAuthoringDTO.setActiveModule(MONITORING);
-
- request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- return new McMonitoringAction().commonSubmitSessionCode(mcMonitoringForm, request, mapping, mcService, mcGeneralMonitoringDTO);
+ String toolContentID = null;
+ try {
+ Long toolContentIDLong = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID, false);
+ toolContentID = toolContentIDLong.toString();
+ mcMonitoringForm.setToolContentId(toolContentID);
+ mcMonitoringForm.setToolContentID(toolContentID);
+ } catch (IllegalArgumentException e) {
+ logger.error("Unable to start monitoring as tool content id is missing");
+ McUtils.cleanUpSessionAbsolute(request);
+ throw (e);
}
+ initialiseMonitoringData(mapping, form, request, response, mcService, mcGeneralMonitoringDTO);
- /**
- initialises monitoring data
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @param mcService
- * @param mcGeneralMonitoringDTO
- * @return
+ mcMonitoringForm.setCurrentTab("1");
+ mcGeneralMonitoringDTO.setCurrentTab("1");
+
+ mcMonitoringForm.setActiveModule(MONITORING);
+ mcGeneralMonitoringDTO.setActiveModule(MONITORING);
+
+ mcMonitoringForm.setSelectedToolSessionId("All");
+ mcGeneralMonitoringDTO.setSelectedToolSessionId("All");
+
+ mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setIsPortfolioExport(new Boolean(false).toString());
+
+ /* this section is needed for Edit Activity screen, from here... */
+ mcGeneralAuthoringDTO.setActivityTitle(mcGeneralMonitoringDTO.getActivityTitle());
+ mcGeneralAuthoringDTO.setActivityInstructions(mcGeneralMonitoringDTO.getActivityInstructions());
+ mcGeneralAuthoringDTO.setActiveModule(MONITORING);
+
+ request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO);
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ return new McMonitoringAction().commonSubmitSessionCode(mcMonitoringForm, request, mapping, mcService,
+ mcGeneralMonitoringDTO);
+ }
+
+ /**
+ * initialises monitoring data
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @param mcService
+ * @param mcGeneralMonitoringDTO
+ * @return
+ */
+ public void initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response, IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) {
+ McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
+ String toolContentID = mcMonitoringForm.getToolContentID();
+
+ McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
+ mcGeneralMonitoringDTO.setToolContentID(toolContentID.toString());
+ mcGeneralMonitoringDTO.setActivityTitle(mcContent.getTitle());
+ mcGeneralMonitoringDTO.setActivityInstructions(mcContent.getInstructions());
+ mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary");
+ mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
+
+ /*
+ * get the questions section is needed for the Edit tab's View Only mode, starts here
*/
- public void initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response,
- IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO)
- {
- McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
- String toolContentID = mcMonitoringForm.getToolContentID();
-
- McContent mcContent=mcService.retrieveMc(new Long(toolContentID));
- mcGeneralMonitoringDTO.setToolContentID(toolContentID.toString());
- mcGeneralMonitoringDTO.setActivityTitle(mcContent.getTitle());
- mcGeneralMonitoringDTO.setActivityInstructions(mcContent.getInstructions());
- mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary");
- mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString());
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString());
-
- /*
- * get the questions
- * section is needed for the Edit tab's View Only mode, starts here
- */
- List listQuestionContentDTO= new LinkedList();
-
- Map mapOptionsContent= new TreeMap(new McComparator());
- mapOptionsContent.clear();
- Iterator queIterator=mcContent.getMcQueContents().iterator();
- Long mapIndex=new Long(1);
- while (queIterator.hasNext())
- {
- McQuestionContentDTO mcContentDTO=new McQuestionContentDTO();
-
- McQueContent mcQueContent=(McQueContent) queIterator.next();
- if (mcQueContent != null)
- {
- mapOptionsContent.put(mapIndex.toString(),mcQueContent.getQuestion());
+ List listQuestionContentDTO = new LinkedList();
- mcContentDTO.setQuestion(mcQueContent.getQuestion());
- mcContentDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString());
- listQuestionContentDTO.add(mcContentDTO);
-
- mapIndex=new Long(mapIndex.longValue()+1);
- }
- }
- mcGeneralMonitoringDTO.setMapOptionsContent(mapOptionsContent);
- /* ends here*/
-
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString());
+ Map mapOptionsContent = new TreeMap(new McComparator());
+ mapOptionsContent.clear();
+ Iterator queIterator = mcContent.getMcQueContents().iterator();
+ Long mapIndex = new Long(1);
+ while (queIterator.hasNext()) {
+ McQuestionContentDTO mcContentDTO = new McQuestionContentDTO();
- /* SELECTION_CASE == 2 indicates start up */
- request.setAttribute(SELECTION_CASE, new Long(2));
-
- /* Default to All for tool Sessions so that all tool sessions' summary information gets displayed when the module starts up */
- request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, "All");
- MonitoringUtil.setupAllSessionsData(request, mcContent,mcService);
- mcGeneralMonitoringDTO.setGroupName("All Groups");
- mcGeneralMonitoringDTO.setSelectionCase(new Long(2));
- mcGeneralMonitoringDTO.setCurrentMonitoredToolSession("All");
- mcGeneralMonitoringDTO.setListMonitoredAnswersContainerDto(new LinkedList());
- mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString());
+ McQueContent mcQueContent = (McQueContent) queIterator.next();
+ if (mcQueContent != null) {
+ mapOptionsContent.put(mapIndex.toString(), mcQueContent.getQuestion());
- // The edit activity code needs a session map
- SessionMap sessionMap = new SessionMap();
- mcMonitoringForm.setHttpSessionID(sessionMap.getSessionID());
- request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ mcContentDTO.setQuestion(mcQueContent.getQuestion());
+ mcContentDTO.setDisplayOrder(mcQueContent.getDisplayOrder().toString());
+ listQuestionContentDTO.add(mcContentDTO);
+
+ mapIndex = new Long(mapIndex.longValue() + 1);
+ }
}
+ mcGeneralMonitoringDTO.setMapOptionsContent(mapOptionsContent);
+ /* ends here */
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- /**
+ mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString());
+
+ /* SELECTION_CASE == 2 indicates start up */
+ request.setAttribute(SELECTION_CASE, new Long(2));
+
+ /*
+ * Default to All for tool Sessions so that all tool sessions' summary information gets displayed when the
+ * module starts up
+ */
+ request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, "All");
+ MonitoringUtil.setupAllSessionsData(request, mcContent, mcService);
+ mcGeneralMonitoringDTO.setGroupName("All Groups");
+ mcGeneralMonitoringDTO.setSelectionCase(new Long(2));
+ mcGeneralMonitoringDTO.setCurrentMonitoredToolSession("All");
+ mcGeneralMonitoringDTO.setListMonitoredAnswersContainerDto(new LinkedList());
+ mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString());
+
+ // The edit activity code needs a session map
+ SessionMap sessionMap = new SessionMap();
+ mcMonitoringForm.setHttpSessionID(sessionMap.getSessionID());
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ }
+
+ /**
* persists error messages to request scope
+ *
* @param request
* @param message
*/
- public void persistInRequestError(HttpServletRequest request, String message)
- {
- ActionMessages errors= new ActionMessages();
- errors.add(Globals.ERROR_KEY, new ActionMessage(message));
- saveErrors(request,errors);
- }
-}
+ public void persistInRequestError(HttpServletRequest request, String message) {
+ ActionMessages errors = new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage(message));
+ saveErrors(request, errors);
+ }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java,v
diff -u -r1.5 -r1.6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java 8 May 2013 13:03:18 -0000 1.5
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerAction.java 8 May 2013 13:18:25 -0000 1.6
@@ -36,7 +36,6 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
-import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
@@ -134,8 +133,8 @@
for (int candidateAnswerDTOIndex = 0; candidateAnswerDTOIndex < candidateAnswerDTOList.size(); candidateAnswerDTOIndex++) {
McCandidateAnswersDTO answerDTO = candidateAnswerDTOList.get(candidateAnswerDTOIndex);
McOptsContent candidateAnswer = new McOptsContent(candidateAnswerDTOIndex + 1,
- McAppConstants.CORRECT.equals(answerDTO.getCorrect()), answerDTO
- .getCandidateAnswer(), mcQueContent, null);
+ McAppConstants.CORRECT.equals(answerDTO.getCorrect()),
+ answerDTO.getCandidateAnswer(), mcQueContent, null);
candidateAnswer.setMcQueContentId(mcQueContent.getMcContentId());
candidateAnswers.add(candidateAnswer);
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java,v
diff -u -r1.3 -r1.4
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java 13 Feb 2009 17:47:06 -0000 1.3
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McPedagogicalPlannerForm.java 8 May 2013 13:18:25 -0000 1.4
@@ -144,8 +144,8 @@
McCandidateAnswersDTO candidateAnswer = candidateAnswers.get(candidateAnswerIndex - 1);
candidateAnswersBuilder.append(McAppConstants.CANDIDATE_ANSWER_PREFIX).append(questionDisplayOrder)
- .append('-').append(candidateAnswerIndex).append('=').append(
- candidateAnswer.getCandidateAnswer()).append('&');
+ .append('-').append(candidateAnswerIndex).append('=')
+ .append(candidateAnswer.getCandidateAnswer()).append('&');
if (candidateAnswer.getCorrect().equals(McAppConstants.CORRECT)) {
setCorrect(questionDisplayOrder - 1, String.valueOf(candidateAnswerIndex));
}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java,v
diff -u -r1.95 -r1.96
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 8 May 2013 13:03:18 -0000 1.95
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 8 May 2013 13:18:25 -0000 1.96
@@ -52,74 +52,74 @@
* The tool content id for this content is created as part of the installation process.
* Whenever a tool is asked for some tool content that does not exist, it should supply the default tool content.
* This will allow the system to render the normal screen, albeit with useless information, rather than crashing.
-*/
+ */
/**
-*
-* Authoring URL:
-*
-* The tool must supply an authoring module, which will be called to create new content or edit existing content. It will be called by an authoring URL using the following format: ?????
-* The initial data displayed on the authoring screen for a new tool content id may be the default tool content.
-*
-* Authoring UI data consists of general Activity data fields and the Tool specific data fields.
-* The authoring interface will have three tabs. The mandatory (and suggested) fields are given. Each tool will have its own fields which it will add on any of the three tabs, as appropriate to the tabs' function.
-*
-* Basic: Displays the basic set of fields that are needed for the tool, and it could be expected that a new LAMS user would use. Mandatory fields: Title, Instructions.
-* Advanced: Displays the extra fields that would be used by experienced LAMS users. Optional fields: Lock On Finish, Make Responses Anonymous
-* Instructions: Displays the "instructions" fields for teachers. Mandatory fields: Online instructions, Offline instructions, Document upload.
-* The "Define Later" and "Run Offline" options are set on the Flash authoring part, and not on the tool's authoring screens.
-*
-* 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.
-* Export The tool must be able to export its tool content for part of the overall learning design export.
-*
-* The format of the serialization for export is XML. Tool will define extra namespace inside the element to add a new data element (type). Inside the data element, it can further define more structures and types as it seems fit.
-* The data elements must be "version" aware. The data elements must be "type" aware if they are to be shared between Tools.
-*
-*
-
+ *
+ * Authoring URL:
+ *
+ * The tool must supply an authoring module, which will be called to create new content or edit existing content. It will be called by an authoring URL using the following format: ?????
+ * The initial data displayed on the authoring screen for a new tool content id may be the default tool content.
+ *
+ * Authoring UI data consists of general Activity data fields and the Tool specific data fields.
+ * The authoring interface will have three tabs. The mandatory (and suggested) fields are given. Each tool will have its own fields which it will add on any of the three tabs, as appropriate to the tabs' function.
+ *
+ * Basic: Displays the basic set of fields that are needed for the tool, and it could be expected that a new LAMS user would use. Mandatory fields: Title, Instructions.
+ * Advanced: Displays the extra fields that would be used by experienced LAMS users. Optional fields: Lock On Finish, Make Responses Anonymous
+ * Instructions: Displays the "instructions" fields for teachers. Mandatory fields: Online instructions, Offline instructions, Document upload.
+ * The "Define Later" and "Run Offline" options are set on the Flash authoring part, and not on the tool's authoring screens.
+ *
+ * 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.
+ * Export The tool must be able to export its tool content for part of the overall learning design export.
+ *
+ * The format of the serialization for export is XML. Tool will define extra namespace inside the element to add a new data element (type). Inside the data element, it can further define more structures and types as it seems fit.
+ * The data elements must be "version" aware. The data elements must be "type" aware if they are to be shared between Tools.
+ *
+ *
+
-
-
+
+
-
-
-
+
-
-
-
-
-
+
-*
-*/
+
+
+
+
+ *
+ */
+
/* $$Id$$ */
package org.lamsfoundation.lams.tool.mc.web;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -156,407 +156,362 @@
*
* @author Ozgur Demirtas
*
- * A Map data structure is used to present the UI.
+ * A Map data structure is used to present the UI.
*/
public class McStarterAction extends Action implements McAppConstants {
- static Logger logger = Logger.getLogger(McStarterAction.class.getName());
-
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException, McApplicationException {
-
- McUtils.cleanUpSessionAbsolute(request);
- McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
-
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- mcAuthoringForm.setContentFolderID(contentFolderID);
-
- McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO();
- mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
-
- Map mapQuestionContent= new TreeMap(new McComparator());
-
- mcAuthoringForm.resetRadioBoxes();
-
- IMcService mcService =null;
- if ((getServlet() == null) || (getServlet().getServletContext() == null))
- {
- mcService=mcAuthoringForm.getMcService();
- }
- else
- {
- mcService =McServiceProxy.getMcService(getServlet().getServletContext());
- }
-
- mcGeneralAuthoringDTO.setCurrentTab("1");
-
-
- mcGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(false).toString());
- String servletPath=request.getServletPath();
- String requestedModule=null;
- if (servletPath.indexOf("authoringStarter") > 0)
- {
- //request is for authoring module
- mcGeneralAuthoringDTO.setActiveModule(AUTHORING);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- mcGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(true).toString());
- mcAuthoringForm.setActiveModule(AUTHORING);
- requestedModule=AUTHORING;
- }
- else
- {
- //request is for define later module either direcly from define later url or monitoring url
- mcGeneralAuthoringDTO.setActiveModule(DEFINE_LATER);
- mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
- mcGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(false).toString());
- mcAuthoringForm.setActiveModule(DEFINE_LATER);
- requestedModule=DEFINE_LATER;
-
- if (servletPath.indexOf("monitoring") > 0)
- {
- //request is from monitoring url
- mcGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(true).toString());
- }
- }
- mcGeneralAuthoringDTO.setRequestedModule(requestedModule);
+ static Logger logger = Logger.getLogger(McStarterAction.class.getName());
-
- String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
-
- boolean validateSignature=readSignature(request,mapping, mcService, mcGeneralAuthoringDTO, mcAuthoringForm);
- if (validateSignature == false)
- {
- logger.debug("error during validation");
- }
-
- /* mark the http session as an authoring activity */
- mcGeneralAuthoringDTO.setTargetMode(TARGET_MODE_AUTHORING);
-
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, McApplicationException {
+
+ McUtils.cleanUpSessionAbsolute(request);
+ McAuthoringForm mcAuthoringForm = (McAuthoringForm) form;
+
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ mcAuthoringForm.setContentFolderID(contentFolderID);
+
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO();
+ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID);
+
+ Map mapQuestionContent = new TreeMap(new McComparator());
+
+ mcAuthoringForm.resetRadioBoxes();
+
+ IMcService mcService = null;
+ if ((getServlet() == null) || (getServlet().getServletContext() == null)) {
+ mcService = mcAuthoringForm.getMcService();
+ } else {
+ mcService = McServiceProxy.getMcService(getServlet().getServletContext());
+ }
+
+ mcGeneralAuthoringDTO.setCurrentTab("1");
+
+ mcGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(false).toString());
+ String servletPath = request.getServletPath();
+ String requestedModule = null;
+ if (servletPath.indexOf("authoringStarter") > 0) {
+ // request is for authoring module
+ mcGeneralAuthoringDTO.setActiveModule(AUTHORING);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ mcGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(true).toString());
+ mcAuthoringForm.setActiveModule(AUTHORING);
+ requestedModule = AUTHORING;
+ } else {
+ // request is for define later module either direcly from define later url or monitoring url
+ mcGeneralAuthoringDTO.setActiveModule(DEFINE_LATER);
+ mcGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
+ mcGeneralAuthoringDTO.setShowAuthoringTabs(new Boolean(false).toString());
+ mcAuthoringForm.setActiveModule(DEFINE_LATER);
+ requestedModule = DEFINE_LATER;
+
+ if (servletPath.indexOf("monitoring") > 0) {
+ // request is from monitoring url
+ mcGeneralAuthoringDTO.setMonitoringOriginatedDefineLater(new Boolean(true).toString());
+ }
+ }
+ mcGeneralAuthoringDTO.setRequestedModule(requestedModule);
+
+ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER);
+
+ boolean validateSignature = readSignature(request, mapping, mcService, mcGeneralAuthoringDTO, mcAuthoringForm);
+ if (validateSignature == false) {
+ logger.debug("error during validation");
+ }
+
+ /* mark the http session as an authoring activity */
+ mcGeneralAuthoringDTO.setTargetMode(TARGET_MODE_AUTHORING);
+
+ /*
+ * find out whether the request is coming from monitoring module for EditActivity tab or from authoring
+ * environment url
+ */
+ String strToolContentID = "";
+ /* the authoring url must be passed a tool content id */
+ strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
+ mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
+
+ SessionMap sessionMap = new SessionMap();
+ List sequentialCheckedCa = new LinkedList();
+ sessionMap.put(ATTACHMENT_LIST_KEY, new ArrayList());
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
+ sessionMap.put(ACTIVITY_TITLE_KEY, "");
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, "");
+ mcAuthoringForm.setHttpSessionID(sessionMap.getSessionID());
+ mcGeneralAuthoringDTO.setHttpSessionID(sessionMap.getSessionID());
+
+ String defaultContentId = null;
+ if (strToolContentID == null) {
/*
- * find out whether the request is coming from monitoring module for EditActivity tab or from authoring environment url
+ * it is possible that the original request for authoring module is coming from monitoring url which keeps
+ * the TOOL_CONTENT_ID in the session
*/
- String strToolContentID="";
- /*the authoring url must be passed a tool content id*/
- strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID);
- mcGeneralAuthoringDTO.setToolContentID(strToolContentID);
-
- SessionMap sessionMap = new SessionMap();
- List sequentialCheckedCa= new LinkedList();
- sessionMap.put(ATTACHMENT_LIST_KEY, new ArrayList());
- sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
- sessionMap.put(ACTIVITY_TITLE_KEY, "");
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, "");
- mcAuthoringForm.setHttpSessionID(sessionMap.getSessionID());
- mcGeneralAuthoringDTO.setHttpSessionID(sessionMap.getSessionID());
-
- String defaultContentId=null;
- if (strToolContentID == null)
- {
- /*it is possible that the original request for authoring module is coming from monitoring url which keeps the
- TOOL_CONTENT_ID in the session*/
-
- Long toolContentID =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
- if (toolContentID != null)
- {
- strToolContentID= toolContentID.toString();
- //cached strToolContentID from the session
- }
- else
- {
- //we should IDEALLY not arrive here. The TOOL_CONTENT_ID is NOT available from the url or the session.
- /*use default content instead of giving a warning*/
- defaultContentId=mcAuthoringForm.getDefaultContentIdStr();
- strToolContentID=defaultContentId;
- }
+
+ Long toolContentID = (Long) request.getSession().getAttribute(TOOL_CONTENT_ID);
+ if (toolContentID != null) {
+ strToolContentID = toolContentID.toString();
+ // cached strToolContentID from the session
+ } else {
+ // we should IDEALLY not arrive here. The TOOL_CONTENT_ID is NOT available from the url or the session.
+ /* use default content instead of giving a warning */
+ defaultContentId = mcAuthoringForm.getDefaultContentIdStr();
+ strToolContentID = defaultContentId;
}
-
- if ((strToolContentID == null) || (strToolContentID.equals("")))
- {
- McUtils.cleanUpSessionAbsolute(request);
- //return (mapping.findForward(ERROR_LIST));
- }
+ }
- mcAuthoringForm.setToolContentID(strToolContentID);
+ if ((strToolContentID == null) || (strToolContentID.equals(""))) {
+ McUtils.cleanUpSessionAbsolute(request);
+ // return (mapping.findForward(ERROR_LIST));
+ }
- /*
- * find out if the passed tool content id exists in the db
- * present user either a first timer screen with default content data or fetch the existing content.
- *
- * if the toolcontentid does not exist in the db, create the default Map,
- * there is no need to check if the content is locked in this case.
- * It is always unlocked since it is the default content.
- */
-
- String defaultContentIdStr=null;
- McContent mcContent=null;
- if (!existsContent(new Long(strToolContentID).longValue(), mcService))
- {
- /*fetch default content*/
- defaultContentIdStr=mcAuthoringForm.getDefaultContentIdStr();
- mcContent=retrieveContent(request, mapping, mcAuthoringForm, mapQuestionContent,
- new Long(defaultContentIdStr).longValue(), true, mcService, mcGeneralAuthoringDTO, sessionMap);
-
- }
- else
- {
- /* it is possible that the content is in use by learners.*/
- mcContent=mcService.retrieveMc(new Long(strToolContentID));
-
- if (mcService.studentActivityOccurredGlobal(mcContent))
- {
- McUtils.cleanUpSessionAbsolute(request);
- }
- mcContent=retrieveContent(request, mapping, mcAuthoringForm, mapQuestionContent,
- new Long(strToolContentID).longValue(),false, mcService, mcGeneralAuthoringDTO, sessionMap);
- }
-
- if ((mcGeneralAuthoringDTO.getOnlineInstructions() == null) || (mcGeneralAuthoringDTO.getOnlineInstructions().length() == 0))
- {
- mcGeneralAuthoringDTO.setOnlineInstructions(DEFAULT_ONLINE_INST);
- mcAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
- sessionMap.put(ONLINE_INSTRUCTIONS_KEY, DEFAULT_ONLINE_INST);
+ mcAuthoringForm.setToolContentID(strToolContentID);
+
+ /*
+ * find out if the passed tool content id exists in the db present user either a first timer screen with default
+ * content data or fetch the existing content.
+ *
+ * if the toolcontentid does not exist in the db, create the default Map, there is no need to check if the
+ * content is locked in this case. It is always unlocked since it is the default content.
+ */
+
+ String defaultContentIdStr = null;
+ McContent mcContent = null;
+ if (!existsContent(new Long(strToolContentID).longValue(), mcService)) {
+ /* fetch default content */
+ defaultContentIdStr = mcAuthoringForm.getDefaultContentIdStr();
+ mcContent = retrieveContent(request, mapping, mcAuthoringForm, mapQuestionContent, new Long(
+ defaultContentIdStr).longValue(), true, mcService, mcGeneralAuthoringDTO, sessionMap);
+
+ } else {
+ /* it is possible that the content is in use by learners. */
+ mcContent = mcService.retrieveMc(new Long(strToolContentID));
+
+ if (mcService.studentActivityOccurredGlobal(mcContent)) {
+ McUtils.cleanUpSessionAbsolute(request);
}
-
- if ((mcGeneralAuthoringDTO.getOfflineInstructions() == null) || (mcGeneralAuthoringDTO.getOfflineInstructions().length() == 0))
- {
- mcGeneralAuthoringDTO.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- mcAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
- sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, DEFAULT_OFFLINE_INST);
- }
+ mcContent = retrieveContent(request, mapping, mcAuthoringForm, mapQuestionContent, new Long(
+ strToolContentID).longValue(), false, mcService, mcGeneralAuthoringDTO, sessionMap);
+ }
-
- String destination=McUtils.getDestination(sourceMcStarter, requestedModule);
- Map mapQuestionContentLocal=mcGeneralAuthoringDTO.getMapQuestionContent();
- sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
-
- AuthoringUtil authoringUtil =new AuthoringUtil();
- List listAddableQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
- sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
-
- request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
-
-
- Map marksMap=authoringUtil.buildMarksMap();
- mcGeneralAuthoringDTO.setMarksMap(marksMap);
- mcGeneralAuthoringDTO.setMarkValue("1");
-
- List listQuestionContentDTOLocal=authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
- Map passMarksMap=authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTOLocal, true);
- mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
-
- String totalMark=AuthoringUtil.getTotalMark(listQuestionContentDTOLocal);
- mcAuthoringForm.setTotalMarks(totalMark);
- mcGeneralAuthoringDTO.setTotalMarks(totalMark);
+ if ((mcGeneralAuthoringDTO.getOnlineInstructions() == null)
+ || (mcGeneralAuthoringDTO.getOnlineInstructions().length() == 0)) {
+ mcGeneralAuthoringDTO.setOnlineInstructions(DEFAULT_ONLINE_INST);
+ mcAuthoringForm.setOnlineInstructions(DEFAULT_ONLINE_INST);
+ sessionMap.put(ONLINE_INSTRUCTIONS_KEY, DEFAULT_ONLINE_INST);
+ }
-
- String passMark=" ";
-
- if ((mcContent.getPassMark() != null) && (mcContent.getPassMark().intValue() != 0))
- passMark=mcContent.getPassMark().toString();
-
-
- mcGeneralAuthoringDTO.setPassMarkValue (passMark);
-
- Map correctMap=authoringUtil.buildCorrectMap();
- mcGeneralAuthoringDTO.setCorrectMap(correctMap);
-
- request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
-
- return (mapping.findForward(destination));
- }
-
- /**
- * retrives the existing content information from the db and prepares the data for presentation purposes.
- *
- * @param request
- * @param mapping
- * @param mcAuthoringForm
- * @param mapQuestionContent
- * @param toolContentID
- * @return ActionForward
- */
- protected McContent retrieveContent(HttpServletRequest request, ActionMapping mapping, McAuthoringForm mcAuthoringForm,
- Map mapQuestionContent, long toolContentID, boolean isDefaultContent, IMcService mcService,
- McGeneralAuthoringDTO mcGeneralAuthoringDTO, SessionMap sessionMap)
- {
- McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
-
- McUtils.populateAuthoringDTO(request, mcContent, mcGeneralAuthoringDTO);
-
- mcAuthoringForm.setSln(mcContent.isShowReport()?"1":"0");
- mcAuthoringForm.setQuestionsSequenced(mcContent.isQuestionsSequenced()?"1":"0");
- mcAuthoringForm.setRandomize(mcContent.isRandomize()?"1":"0");
- mcAuthoringForm.setDisplayAnswers(mcContent.isDisplayAnswers()?"1":"0");
- mcAuthoringForm.setShowMarks(mcContent.isShowMarks()?"1":"0");
-
- mcAuthoringForm.setRetries(mcContent.isRetries()?"1":"0");
- mcAuthoringForm.setReflect(mcContent.isReflect()?"1":"0");
- mcAuthoringForm.setReflectionSubject(mcContent.getReflectionSubject());
-
- mcGeneralAuthoringDTO.setSln(mcContent.isShowReport()?"1":"0");
- mcGeneralAuthoringDTO.setQuestionsSequenced(mcContent.isQuestionsSequenced()?"1":"0");
- mcGeneralAuthoringDTO.setRandomize(mcContent.isRandomize()?"1":"0");
- mcGeneralAuthoringDTO.setDisplayAnswers(mcContent.isDisplayAnswers()?"1":"0");
- mcGeneralAuthoringDTO.setRetries(mcContent.isRetries()?"1":"0");
- mcGeneralAuthoringDTO.setReflect(mcContent.isReflect()?"1":"0");
- mcGeneralAuthoringDTO.setReflectionSubject(mcContent.getReflectionSubject());
-
-
- List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
- mcGeneralAuthoringDTO.setAttachmentList(attachmentList);
- mcGeneralAuthoringDTO.setDeletedAttachmentList(new ArrayList());
+ if ((mcGeneralAuthoringDTO.getOfflineInstructions() == null)
+ || (mcGeneralAuthoringDTO.getOfflineInstructions().length() == 0)) {
+ mcGeneralAuthoringDTO.setOfflineInstructions(DEFAULT_OFFLINE_INST);
+ mcAuthoringForm.setOfflineInstructions(DEFAULT_OFFLINE_INST);
+ sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, DEFAULT_OFFLINE_INST);
+ }
- sessionMap.put(ATTACHMENT_LIST_KEY, attachmentList);
- sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
+ String destination = McUtils.getDestination(sourceMcStarter, requestedModule);
+ Map mapQuestionContentLocal = mcGeneralAuthoringDTO.getMapQuestionContent();
+ sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List listAddableQuestionContentDTO = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+ sessionMap.put(NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO);
- mcGeneralAuthoringDTO.setIsDefineLater(new Boolean(mcContent.isDefineLater()).toString());
-
- mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
- mcAuthoringForm.setTitle(mcContent.getTitle());
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
- mcGeneralAuthoringDTO.setActivityInstructions( mcContent.getInstructions());
- mcAuthoringForm.setInstructions(mcContent.getInstructions());
-
- sessionMap.put(ACTIVITY_TITLE_KEY, mcGeneralAuthoringDTO.getActivityTitle());
- sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcGeneralAuthoringDTO.getActivityInstructions());
+ Map marksMap = authoringUtil.buildMarksMap();
+ mcGeneralAuthoringDTO.setMarksMap(marksMap);
+ mcGeneralAuthoringDTO.setMarkValue("1");
-
- AuthoringUtil authoringUtil= new AuthoringUtil();
- List listQuestionContentDTO=authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+ List listQuestionContentDTOLocal = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+ Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTOLocal, true);
+ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap);
- request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO);
- sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
-
-
- if (isDefaultContent)
- {
- //overwriting default question
- mcGeneralAuthoringDTO.setDefaultQuestionContent("Sample Question 1?");
-
- }
-
- mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
- mcGeneralAuthoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcGeneralAuthoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
-
- mcAuthoringForm.setOnlineInstructions(mcContent.getOnlineInstructions());
- mcAuthoringForm.setOfflineInstructions(mcContent.getOfflineInstructions());
- sessionMap.put(ONLINE_INSTRUCTIONS_KEY, mcContent.getOnlineInstructions());
- sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, mcContent.getOfflineInstructions());
-
- mcAuthoringForm.resetUserAction();
- return mcContent;
- }
+ String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTOLocal);
+ mcAuthoringForm.setTotalMarks(totalMark);
+ mcGeneralAuthoringDTO.setTotalMarks(totalMark);
-
- /**
- * each tool has a signature. MC tool's signature is stored in MY_SIGNATURE. The default tool content id and
- * other depending content ids are obtained in this method.
- * if all the default content has been setup properly the method persists DEFAULT_CONTENT_ID in the session.
- * @param request
- * @param mapping
- * @return ActionForward
- */
- public boolean readSignature(HttpServletRequest request, ActionMapping mapping, IMcService mcService,
- McGeneralAuthoringDTO mcGeneralAuthoringDTO, McAuthoringForm mcAuthoringForm)
- {
- /*
- * retrieve the default content id based on tool signature
- */
- long defaultContentID=0;
- try
- {
- defaultContentID=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
- if (defaultContentID == 0)
- {
- //default content id has not been setup
- return false;
- }
- }
- catch(Exception e)
- {
- logger.debug("error getting the default content id: " + e.getMessage());
- persistError(request,"error.defaultContent.notSetup");
- return false;
- }
+ String passMark = " ";
-
- /* retrieve uid of the content based on default content id determined above */
- long contentUID=0;
- try
- {
- McContent mcContent=mcService.retrieveMc(new Long(defaultContentID));
- if (mcContent == null)
- {
- logger.debug("Exception occured: No default content");
- persistError(request,"error.defaultContent.notSetup");
- return false;
- }
- contentUID=mcContent.getUid().longValue();
- }
- catch(Exception e)
- {
- logger.debug("Exception occured: No default question content");
- persistError(request,"error.defaultContent.notSetup");
- return false;
- }
+ if ((mcContent.getPassMark() != null) && (mcContent.getPassMark().intValue() != 0))
+ passMark = mcContent.getPassMark().toString();
-
- mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
- mcAuthoringForm.setDefaultContentIdStr(new Long(defaultContentID).toString());
-
- return true;
+ mcGeneralAuthoringDTO.setPassMarkValue(passMark);
+
+ Map correctMap = authoringUtil.buildCorrectMap();
+ mcGeneralAuthoringDTO.setCorrectMap(correctMap);
+
+ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO);
+
+ return (mapping.findForward(destination));
+ }
+
+ /**
+ * retrives the existing content information from the db and prepares the data for presentation purposes.
+ *
+ * @param request
+ * @param mapping
+ * @param mcAuthoringForm
+ * @param mapQuestionContent
+ * @param toolContentID
+ * @return ActionForward
+ */
+ protected McContent retrieveContent(HttpServletRequest request, ActionMapping mapping,
+ McAuthoringForm mcAuthoringForm, Map mapQuestionContent, long toolContentID, boolean isDefaultContent,
+ IMcService mcService, McGeneralAuthoringDTO mcGeneralAuthoringDTO, SessionMap sessionMap) {
+ McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
+
+ McUtils.populateAuthoringDTO(request, mcContent, mcGeneralAuthoringDTO);
+
+ mcAuthoringForm.setSln(mcContent.isShowReport() ? "1" : "0");
+ mcAuthoringForm.setQuestionsSequenced(mcContent.isQuestionsSequenced() ? "1" : "0");
+ mcAuthoringForm.setRandomize(mcContent.isRandomize() ? "1" : "0");
+ mcAuthoringForm.setDisplayAnswers(mcContent.isDisplayAnswers() ? "1" : "0");
+ mcAuthoringForm.setShowMarks(mcContent.isShowMarks() ? "1" : "0");
+
+ mcAuthoringForm.setRetries(mcContent.isRetries() ? "1" : "0");
+ mcAuthoringForm.setReflect(mcContent.isReflect() ? "1" : "0");
+ mcAuthoringForm.setReflectionSubject(mcContent.getReflectionSubject());
+
+ mcGeneralAuthoringDTO.setSln(mcContent.isShowReport() ? "1" : "0");
+ mcGeneralAuthoringDTO.setQuestionsSequenced(mcContent.isQuestionsSequenced() ? "1" : "0");
+ mcGeneralAuthoringDTO.setRandomize(mcContent.isRandomize() ? "1" : "0");
+ mcGeneralAuthoringDTO.setDisplayAnswers(mcContent.isDisplayAnswers() ? "1" : "0");
+ mcGeneralAuthoringDTO.setRetries(mcContent.isRetries() ? "1" : "0");
+ mcGeneralAuthoringDTO.setReflect(mcContent.isReflect() ? "1" : "0");
+ mcGeneralAuthoringDTO.setReflectionSubject(mcContent.getReflectionSubject());
+
+ List attachmentList = mcService.retrieveMcUploadedFiles(mcContent);
+ mcGeneralAuthoringDTO.setAttachmentList(attachmentList);
+ mcGeneralAuthoringDTO.setDeletedAttachmentList(new ArrayList());
+
+ sessionMap.put(ATTACHMENT_LIST_KEY, attachmentList);
+ sessionMap.put(DELETED_ATTACHMENT_LIST_KEY, new ArrayList());
+
+ mcGeneralAuthoringDTO.setIsDefineLater(new Boolean(mcContent.isDefineLater()).toString());
+
+ mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle());
+ mcAuthoringForm.setTitle(mcContent.getTitle());
+
+ mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions());
+ mcAuthoringForm.setInstructions(mcContent.getInstructions());
+
+ sessionMap.put(ACTIVITY_TITLE_KEY, mcGeneralAuthoringDTO.getActivityTitle());
+ sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcGeneralAuthoringDTO.getActivityInstructions());
+
+ AuthoringUtil authoringUtil = new AuthoringUtil();
+ List listQuestionContentDTO = authoringUtil.buildDefaultQuestionContent(mcContent, mcService);
+
+ request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
+ request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
+ sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
+
+ if (isDefaultContent) {
+ // overwriting default question
+ mcGeneralAuthoringDTO.setDefaultQuestionContent("Sample Question 1?");
+
}
-
-
-
- /**
- * @param long toolContentID
- * @return boolean
- * determine whether a specific toolContentID exists in the db
+
+ mcGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
+ mcGeneralAuthoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcGeneralAuthoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions());
+
+ mcAuthoringForm.setOnlineInstructions(mcContent.getOnlineInstructions());
+ mcAuthoringForm.setOfflineInstructions(mcContent.getOfflineInstructions());
+ sessionMap.put(ONLINE_INSTRUCTIONS_KEY, mcContent.getOnlineInstructions());
+ sessionMap.put(OFFLINE_INSTRUCTIONS_KEY, mcContent.getOfflineInstructions());
+
+ mcAuthoringForm.resetUserAction();
+ return mcContent;
+ }
+
+ /**
+ * each tool has a signature. MC tool's signature is stored in MY_SIGNATURE. The default tool content id and other
+ * depending content ids are obtained in this method. if all the default content has been setup properly the method
+ * persists DEFAULT_CONTENT_ID in the session.
+ *
+ * @param request
+ * @param mapping
+ * @return ActionForward
+ */
+ public boolean readSignature(HttpServletRequest request, ActionMapping mapping, IMcService mcService,
+ McGeneralAuthoringDTO mcGeneralAuthoringDTO, McAuthoringForm mcAuthoringForm) {
+ /*
+ * retrieve the default content id based on tool signature
*/
- protected boolean existsContent(long toolContentID, IMcService mcService)
- {
- McContent mcContent=mcService.retrieveMc(new Long(toolContentID));
- if (mcContent == null)
- return false;
-
- return true;
+ long defaultContentID = 0;
+ try {
+ defaultContentID = mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
+ if (defaultContentID == 0) {
+ // default content id has not been setup
+ return false;
+ }
+ } catch (Exception e) {
+ logger.debug("error getting the default content id: " + e.getMessage());
+ persistError(request, "error.defaultContent.notSetup");
+ return false;
}
-
-
- /**
- * bridges define later url request to authoring functionality
- *
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @param mcService
- * @return
- * @throws IOException
- * @throws ServletException
- * @throws McApplicationException
- */
- public ActionForward executeDefineLater(ActionMapping mapping, McAuthoringForm mcAuthoringForm,
- HttpServletRequest request, HttpServletResponse response, IMcService mcService)
- throws IOException, ServletException, McApplicationException {
- return execute(mapping, mcAuthoringForm, request, response);
+
+ /* retrieve uid of the content based on default content id determined above */
+ long contentUID = 0;
+ try {
+ McContent mcContent = mcService.retrieveMc(new Long(defaultContentID));
+ if (mcContent == null) {
+ logger.debug("Exception occured: No default content");
+ persistError(request, "error.defaultContent.notSetup");
+ return false;
+ }
+ contentUID = mcContent.getUid().longValue();
+ } catch (Exception e) {
+ logger.debug("Exception occured: No default question content");
+ persistError(request, "error.defaultContent.notSetup");
+ return false;
}
-
- /**
+ mcGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
+ mcAuthoringForm.setDefaultContentIdStr(new Long(defaultContentID).toString());
+
+ return true;
+ }
+
+ /**
+ * @param long toolContentID
+ * @return boolean determine whether a specific toolContentID exists in the db
+ */
+ protected boolean existsContent(long toolContentID, IMcService mcService) {
+ McContent mcContent = mcService.retrieveMc(new Long(toolContentID));
+ if (mcContent == null)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * bridges define later url request to authoring functionality
+ *
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @param mcService
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws McApplicationException
+ */
+ public ActionForward executeDefineLater(ActionMapping mapping, McAuthoringForm mcAuthoringForm,
+ HttpServletRequest request, HttpServletResponse response, IMcService mcService) throws IOException,
+ ServletException, McApplicationException {
+ return execute(mapping, mcAuthoringForm, request, response);
+ }
+
+ /**
* 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));
- saveErrors(request,errors);
- }
-}
-
+ public void persistError(HttpServletRequest request, String message) {
+ ActionMessages errors = new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage(message));
+ saveErrors(request, errors);
+ }
+}
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java,v
diff -u -r1.36 -r1.37
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java 8 May 2013 13:03:17 -0000 1.36
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java 8 May 2013 13:18:25 -0000 1.37
@@ -34,7 +34,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.log4j.Logger;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
import org.lamsfoundation.lams.tool.mc.McAllGroupsDTO;
@@ -58,441 +57,411 @@
/**
*
- * Keeps all operations needed for Monitoring mode.
+ * Keeps all operations needed for Monitoring mode.
+ *
* @author Ozgur Demirtas
- *
+ *
*/
-public class MonitoringUtil implements McAppConstants{
-
- /**
- *
- * ends up populating the attempt history for all the users of all the tool sessions for a content
- *
- * @param request
- * @param mcContent
- * @return List
- */
- public static List buildGroupsQuestionData(HttpServletRequest request, McContent mcContent, IMcService mcService)
- {
- //will be building groups question data for content
-
- List listQuestions=mcService.getAllQuestionEntries(mcContent.getUid());
-
- List listMonitoredAnswersContainerDTO= new LinkedList();
-
- Iterator itListQuestions = listQuestions.iterator();
- while (itListQuestions.hasNext())
- {
- McQueContent mcQueContent =(McQueContent)itListQuestions.next();
-
- if (mcQueContent != null)
- {
- McMonitoredAnswersDTO mcMonitoredAnswersDTO= new McMonitoredAnswersDTO();
- mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
- mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
- mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString());
-
- List listCandidateAnswersDTO=mcService.populateCandidateAnswersDTO(mcQueContent.getUid());
- mcMonitoredAnswersDTO.setCandidateAnswersCorrect(listCandidateAnswersDTO);
-
- Map questionAttemptData= buildGroupsAttemptData(request, mcContent, mcQueContent, mcQueContent.getUid(), mcService, null);
- mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
- listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
-
- }
- }
- return listMonitoredAnswersContainerDTO;
- }
+public class MonitoringUtil implements McAppConstants {
-
- /**
- *
- * @param request
- * @param mcContent
- * @param mcService
- * @param mcSession
- * @param mcQueUsr
- * @return
- */
- public static List buildGroupsQuestionDataForExportLearner(HttpServletRequest request, McContent mcContent,
- IMcService mcService, McSession mcSession, McQueUsr mcQueUsr)
- {
-
- List listQuestions=mcService.getAllQuestionEntries(mcContent.getUid());
-
- List listMonitoredAnswersContainerDTO= new LinkedList();
-
- Iterator itListQuestions = listQuestions.iterator();
- while (itListQuestions.hasNext())
- {
- McQueContent mcQueContent =(McQueContent)itListQuestions.next();
-
- if (mcQueContent != null)
- {
- McMonitoredAnswersDTO mcMonitoredAnswersDTO= new McMonitoredAnswersDTO();
- mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
- mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
- mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString());
-
- List listCandidateAnswersDTO=mcService.populateCandidateAnswersDTO(mcQueContent.getUid());
- mcMonitoredAnswersDTO.setCandidateAnswersCorrect(listCandidateAnswersDTO);
-
- // Get the attempts for this user. The maps must match the maps in buildGroupsAttemptData or the jsp won't work.
- List listMonitoredUserContainerDTO=getAttemptEntries(request, mcService, mcQueUsr, mcSession, mcQueContent.getUid(), new LinkedList(), false);
- Map questionAttemptData = new TreeMap(new McStringComparator());
- questionAttemptData.put(mcSession.getSession_name(), listMonitoredUserContainerDTO);
+ /**
+ *
+ * ends up populating the attempt history for all the users of all the tool sessions for a content
+ *
+ * @param request
+ * @param mcContent
+ * @return List
+ */
+ public static List buildGroupsQuestionData(HttpServletRequest request, McContent mcContent, IMcService mcService) {
+ // will be building groups question data for content
- mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
- listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
- }
- }
- return listMonitoredAnswersContainerDTO;
+ List listQuestions = mcService.getAllQuestionEntries(mcContent.getUid());
+
+ List listMonitoredAnswersContainerDTO = new LinkedList();
+
+ Iterator itListQuestions = listQuestions.iterator();
+ while (itListQuestions.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) itListQuestions.next();
+
+ if (mcQueContent != null) {
+ McMonitoredAnswersDTO mcMonitoredAnswersDTO = new McMonitoredAnswersDTO();
+ mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
+ mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
+ mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString());
+
+ List listCandidateAnswersDTO = mcService.populateCandidateAnswersDTO(mcQueContent.getUid());
+ mcMonitoredAnswersDTO.setCandidateAnswersCorrect(listCandidateAnswersDTO);
+
+ Map questionAttemptData = buildGroupsAttemptData(request, mcContent, mcQueContent,
+ mcQueContent.getUid(), mcService, null);
+ mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
+ listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
+
+ }
}
-
+ return listMonitoredAnswersContainerDTO;
+ }
- /**
- *
- * @param request
- * @param mcContent
- * @param mcService
- * @return
- */
- public static List buildGroupsMarkData(HttpServletRequest request, McContent mcContent, IMcService mcService)
- {
- List listMonitoredMarksContainerDTO= new LinkedList();
- Set sessions=mcContent.getMcSessions();
- Iterator sessionsIterator=sessions.iterator();
- int numQuestions = mcContent.getMcQueContents().size();
-
- while (sessionsIterator.hasNext())
- {
- McSession mcSession=(McSession) sessionsIterator.next();
-
- McSessionMarkDTO mcSessionMarkDTO= new McSessionMarkDTO();
- mcSessionMarkDTO.setSessionId(mcSession.getMcSessionId().toString());
- mcSessionMarkDTO.setSessionName(mcSession.getSession_name().toString());
-
- Set sessionUsers=mcSession.getMcQueUsers();
- Iterator usersIterator=sessionUsers.iterator();
-
- Map mapSessionUsersData= new TreeMap(new McStringComparator());
- Long mapIndex=new Long(1);
+ /**
+ *
+ * @param request
+ * @param mcContent
+ * @param mcService
+ * @param mcSession
+ * @param mcQueUsr
+ * @return
+ */
+ public static List buildGroupsQuestionDataForExportLearner(HttpServletRequest request, McContent mcContent,
+ IMcService mcService, McSession mcSession, McQueUsr mcQueUsr) {
- while (usersIterator.hasNext())
- {
- McQueUsr mcQueUsr=(McQueUsr) usersIterator.next();
-
- McUserMarkDTO mcUserMarkDTO= new McUserMarkDTO();
- mcUserMarkDTO.setSessionId(mcSession.getMcSessionId().toString());
- mcUserMarkDTO.setSessionName(mcSession.getSession_name().toString());
- mcUserMarkDTO.setFullName(mcQueUsr.getFullname());
- mcUserMarkDTO.setUserName(mcQueUsr.getUsername());
- mcUserMarkDTO.setQueUsrId(mcQueUsr.getUid().toString());
-
- // The marks for the user must be listed in the display order of the question.
- // Other parts of the code assume that the questions will be in consecutive display
- // order starting 1 (e.g. 1, 2, 3, not 1, 3, 4) so we set up an array and use
- // the ( display order - 1) as the index (arrays start at 0, rather than 1 hence -1)
- // The user must answer all questions, so we can assume that they will have marks
- // for all questions or no questions.
- // At present there can only be one answer for each question but there may be more
- // than one in the future and if so, we don't want to count the mark twice hence
- // we need to check if we've already processed this question in the total.
- Integer[] userMarks = new Integer[numQuestions];
- Date attemptTime = null;
- Iterator attemptIterator = mcService.getLatestAttemptsForAUser(mcQueUsr.getUid()).iterator();
- long totalMark = 0;
- while (attemptIterator.hasNext())
- {
- McUsrAttempt attempt =(McUsrAttempt)attemptIterator.next();
- Integer displayOrder = attempt.getMcQueContent().getDisplayOrder();
- int arrayIndex = displayOrder != null && displayOrder.intValue() > 0 ? displayOrder.intValue() - 1 : 1;
- if ( userMarks[arrayIndex] == null ) {
+ List listQuestions = mcService.getAllQuestionEntries(mcContent.getUid());
- // We get the mark for the attempt if the answer is correct and we don't allow
- // retries, or if the answer is correct and the learner has met the passmark if
- // we do allow retries.
- Integer mark = attempt.getMarkForShow(mcSession.getMcContent().isRetries());
- userMarks[arrayIndex] = mark;
- totalMark += mark.intValue();
- }
- // get the attempt time, (NB all questions will have the same attempt time)
- // Not efficient, since we assign this value for each attempt
- attemptTime = attempt.getAttemptTime();
- }
-
- mcUserMarkDTO.setMarks(userMarks);
- mcUserMarkDTO.setAttemptTime(attemptTime);
- mcUserMarkDTO.setTotalMark(new Long(totalMark));
-
- mapSessionUsersData.put(mapIndex.toString(), mcUserMarkDTO);
- mapIndex=new Long(mapIndex.longValue()+1);
- }
-
- mcSessionMarkDTO.setUserMarks(mapSessionUsersData);
- listMonitoredMarksContainerDTO.add(mcSessionMarkDTO);
- }
-
-
- return listMonitoredMarksContainerDTO;
+ List listMonitoredAnswersContainerDTO = new LinkedList();
+
+ Iterator itListQuestions = listQuestions.iterator();
+ while (itListQuestions.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) itListQuestions.next();
+
+ if (mcQueContent != null) {
+ McMonitoredAnswersDTO mcMonitoredAnswersDTO = new McMonitoredAnswersDTO();
+ mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
+ mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
+ mcMonitoredAnswersDTO.setMark(mcQueContent.getMark().toString());
+
+ List listCandidateAnswersDTO = mcService.populateCandidateAnswersDTO(mcQueContent.getUid());
+ mcMonitoredAnswersDTO.setCandidateAnswersCorrect(listCandidateAnswersDTO);
+
+ // Get the attempts for this user. The maps must match the maps in buildGroupsAttemptData or the jsp
+ // won't work.
+ List listMonitoredUserContainerDTO = getAttemptEntries(request, mcService, mcQueUsr, mcSession,
+ mcQueContent.getUid(), new LinkedList(), false);
+ Map questionAttemptData = new TreeMap(new McStringComparator());
+ questionAttemptData.put(mcSession.getSession_name(), listMonitoredUserContainerDTO);
+
+ mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
+ listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
+ }
}
+ return listMonitoredAnswersContainerDTO;
+ }
- /**
- *
- * helps populating user's attempt history
- *
- * @param request
- * @param mcContent
- * @param mcQueContent
- * @return Map
- */
- public static Map buildGroupsAttemptData(HttpServletRequest request, McContent mcContent, McQueContent mcQueContent,
- Long questionUid, IMcService mcService, McQueUsr mcQueUsr)
- {
- Map mapMonitoredAttemptsContainerDTO= new TreeMap(new McStringComparator());
-
- Iterator sessionIterator = mcContent.getMcSessions().iterator();
- while (sessionIterator.hasNext())
- {
- McSession mcSession = (McSession) sessionIterator.next();
- Set listMcUsers=mcSession.getMcQueUsers();
- List sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, mcService);
- mapMonitoredAttemptsContainerDTO.put(mcSession.getSession_name(), sessionUsersAttempts);
+ /**
+ *
+ * @param request
+ * @param mcContent
+ * @param mcService
+ * @return
+ */
+ public static List buildGroupsMarkData(HttpServletRequest request, McContent mcContent, IMcService mcService) {
+ List listMonitoredMarksContainerDTO = new LinkedList();
+ Set sessions = mcContent.getMcSessions();
+ Iterator sessionsIterator = sessions.iterator();
+ int numQuestions = mcContent.getMcQueContents().size();
+
+ while (sessionsIterator.hasNext()) {
+ McSession mcSession = (McSession) sessionsIterator.next();
+
+ McSessionMarkDTO mcSessionMarkDTO = new McSessionMarkDTO();
+ mcSessionMarkDTO.setSessionId(mcSession.getMcSessionId().toString());
+ mcSessionMarkDTO.setSessionName(mcSession.getSession_name().toString());
+
+ Set sessionUsers = mcSession.getMcQueUsers();
+ Iterator usersIterator = sessionUsers.iterator();
+
+ Map mapSessionUsersData = new TreeMap(new McStringComparator());
+ Long mapIndex = new Long(1);
+
+ while (usersIterator.hasNext()) {
+ McQueUsr mcQueUsr = (McQueUsr) usersIterator.next();
+
+ McUserMarkDTO mcUserMarkDTO = new McUserMarkDTO();
+ mcUserMarkDTO.setSessionId(mcSession.getMcSessionId().toString());
+ mcUserMarkDTO.setSessionName(mcSession.getSession_name().toString());
+ mcUserMarkDTO.setFullName(mcQueUsr.getFullname());
+ mcUserMarkDTO.setUserName(mcQueUsr.getUsername());
+ mcUserMarkDTO.setQueUsrId(mcQueUsr.getUid().toString());
+
+ // The marks for the user must be listed in the display order of the question.
+ // Other parts of the code assume that the questions will be in consecutive display
+ // order starting 1 (e.g. 1, 2, 3, not 1, 3, 4) so we set up an array and use
+ // the ( display order - 1) as the index (arrays start at 0, rather than 1 hence -1)
+ // The user must answer all questions, so we can assume that they will have marks
+ // for all questions or no questions.
+ // At present there can only be one answer for each question but there may be more
+ // than one in the future and if so, we don't want to count the mark twice hence
+ // we need to check if we've already processed this question in the total.
+ Integer[] userMarks = new Integer[numQuestions];
+ Date attemptTime = null;
+ Iterator attemptIterator = mcService.getLatestAttemptsForAUser(mcQueUsr.getUid()).iterator();
+ long totalMark = 0;
+ while (attemptIterator.hasNext()) {
+ McUsrAttempt attempt = (McUsrAttempt) attemptIterator.next();
+ Integer displayOrder = attempt.getMcQueContent().getDisplayOrder();
+ int arrayIndex = displayOrder != null && displayOrder.intValue() > 0 ? displayOrder.intValue() - 1
+ : 1;
+ if (userMarks[arrayIndex] == null) {
+
+ // We get the mark for the attempt if the answer is correct and we don't allow
+ // retries, or if the answer is correct and the learner has met the passmark if
+ // we do allow retries.
+ Integer mark = attempt.getMarkForShow(mcSession.getMcContent().isRetries());
+ userMarks[arrayIndex] = mark;
+ totalMark += mark.intValue();
+ }
+ // get the attempt time, (NB all questions will have the same attempt time)
+ // Not efficient, since we assign this value for each attempt
+ attemptTime = attempt.getAttemptTime();
}
- return mapMonitoredAttemptsContainerDTO;
+ mcUserMarkDTO.setMarks(userMarks);
+ mcUserMarkDTO.setAttemptTime(attemptTime);
+ mcUserMarkDTO.setTotalMark(new Long(totalMark));
+
+ mapSessionUsersData.put(mapIndex.toString(), mcUserMarkDTO);
+ mapIndex = new Long(mapIndex.longValue() + 1);
+ }
+
+ mcSessionMarkDTO.setUserMarks(mapSessionUsersData);
+ listMonitoredMarksContainerDTO.add(mcSessionMarkDTO);
}
- /**
- *
- * ends up populating all the user's attempt data of a particular tool session
- *
- * if userID is not null, it only gets the attempts for that user.
- *
- * @param request
- * @param listMcUsers
- * @return List
- */
- public static List populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, Set listMcUsers, Long questionUid, IMcService mcService)
- {
-
- McSession mcSession=mcService.retrieveMcSession(sessionId);
+ return listMonitoredMarksContainerDTO;
+ }
- List listMonitoredUserContainerDTO= new LinkedList();
- Iterator itUsers=listMcUsers.iterator();
- while (itUsers.hasNext())
- {
- McQueUsr mcQueUsr=(McQueUsr)itUsers.next();
- listMonitoredUserContainerDTO=getAttemptEntries(request, mcService, mcQueUsr, mcSession, questionUid, listMonitoredUserContainerDTO, true);
- }
-
- return listMonitoredUserContainerDTO;
+ /**
+ *
+ * helps populating user's attempt history
+ *
+ * @param request
+ * @param mcContent
+ * @param mcQueContent
+ * @return Map
+ */
+ public static Map buildGroupsAttemptData(HttpServletRequest request, McContent mcContent,
+ McQueContent mcQueContent, Long questionUid, IMcService mcService, McQueUsr mcQueUsr) {
+ Map mapMonitoredAttemptsContainerDTO = new TreeMap(new McStringComparator());
+
+ Iterator sessionIterator = mcContent.getMcSessions().iterator();
+ while (sessionIterator.hasNext()) {
+ McSession mcSession = (McSession) sessionIterator.next();
+ Set listMcUsers = mcSession.getMcQueUsers();
+ List sessionUsersAttempts = populateSessionUsersAttempts(request, mcSession.getMcSessionId(), listMcUsers,
+ questionUid, mcService);
+ mapMonitoredAttemptsContainerDTO.put(mcSession.getSession_name(), sessionUsersAttempts);
}
-
- /**
- *
- * @param request
- * @param mcService
- * @param mcQueUsr
- * @param mcSession
- * @param questionUid
- * @param listMonitoredUserContainerDTO
- * @param mapMonitoredUserContainerDTO
- * @return
- */
- public static List getAttemptEntries(HttpServletRequest request, IMcService mcService, McQueUsr mcQueUsr, McSession mcSession,
- Long questionUid, List listMonitoredUserContainerDTO, boolean latestOnly)
- {
-
- if (mcQueUsr != null)
- {
-
- McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
- mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
- mcMonitoredUserDTO.setSessionId(mcSession.getMcSessionId().toString());
- mcMonitoredUserDTO.setQuestionUid(questionUid.toString());
- mcMonitoredUserDTO.setQueUsrId(mcQueUsr.getUid().toString());
- List listUserAttempts = null;
- if ( latestOnly )
- listUserAttempts = mcService.getLatestAttemptsForAUserForOneQuestionContent(mcQueUsr.getUid(), questionUid);
- else
- listUserAttempts = mcService.getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(mcQueUsr.getUid(), questionUid);
-
- if (listUserAttempts.size() == 0 ) {
+ return mapMonitoredAttemptsContainerDTO;
+ }
- mcMonitoredUserDTO.setMark(new Integer(0));
+ /**
+ *
+ * ends up populating all the user's attempt data of a particular tool session
+ *
+ * if userID is not null, it only gets the attempts for that user.
+ *
+ * @param request
+ * @param listMcUsers
+ * @return List
+ */
+ public static List populateSessionUsersAttempts(HttpServletRequest request, Long sessionId, Set listMcUsers,
+ Long questionUid, IMcService mcService) {
- } else {
+ McSession mcSession = mcService.retrieveMcSession(sessionId);
- // At present, we expect there to be only one answer to a question but there
- // could be more in the future - if that happens then we need to change
- // String to a list of Strings.
+ List listMonitoredUserContainerDTO = new LinkedList();
+ Iterator itUsers = listMcUsers.iterator();
+ while (itUsers.hasNext()) {
+ McQueUsr mcQueUsr = (McQueUsr) itUsers.next();
+ listMonitoredUserContainerDTO = getAttemptEntries(request, mcService, mcQueUsr, mcSession, questionUid,
+ listMonitoredUserContainerDTO, true);
+ }
- // We get the mark for the attempt if the answer is correct and we don't allow
- // retries, or if the answer is correct and the learner has met the passmark if
- // we do allow retries.
-
- Map attemptMap = new TreeMap();
- for ( McUsrAttempt attempt : listUserAttempts) {
- attemptMap.put(attempt.getAttemptOrder(), attempt.getMcOptionsContent().getMcQueOptionText());
- mcMonitoredUserDTO.setMark( attempt.getMarkForShow(mcSession.getMcContent().isRetries()) );
- mcMonitoredUserDTO.setIsCorrect( new Boolean(attempt.isAttemptCorrect()).toString() );
- }
- mcMonitoredUserDTO.setUsersAttempts(attemptMap);
- }
-
- listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+ return listMonitoredUserContainerDTO;
+ }
+ /**
+ *
+ * @param request
+ * @param mcService
+ * @param mcQueUsr
+ * @param mcSession
+ * @param questionUid
+ * @param listMonitoredUserContainerDTO
+ * @param mapMonitoredUserContainerDTO
+ * @return
+ */
+ public static List getAttemptEntries(HttpServletRequest request, IMcService mcService, McQueUsr mcQueUsr,
+ McSession mcSession, Long questionUid, List listMonitoredUserContainerDTO, boolean latestOnly) {
+
+ if (mcQueUsr != null) {
+
+ McMonitoredUserDTO mcMonitoredUserDTO = new McMonitoredUserDTO();
+ mcMonitoredUserDTO.setUserName(mcQueUsr.getFullname());
+ mcMonitoredUserDTO.setSessionId(mcSession.getMcSessionId().toString());
+ mcMonitoredUserDTO.setQuestionUid(questionUid.toString());
+ mcMonitoredUserDTO.setQueUsrId(mcQueUsr.getUid().toString());
+
+ List listUserAttempts = null;
+ if (latestOnly)
+ listUserAttempts = mcService.getLatestAttemptsForAUserForOneQuestionContent(mcQueUsr.getUid(),
+ questionUid);
+ else
+ listUserAttempts = mcService.getAllAttemptsForAUserForOneQuestionContentOrderByAttempt(
+ mcQueUsr.getUid(), questionUid);
+
+ if (listUserAttempts.size() == 0) {
+
+ mcMonitoredUserDTO.setMark(new Integer(0));
+
+ } else {
+
+ // At present, we expect there to be only one answer to a question but there
+ // could be more in the future - if that happens then we need to change
+ // String to a list of Strings.
+
+ // We get the mark for the attempt if the answer is correct and we don't allow
+ // retries, or if the answer is correct and the learner has met the passmark if
+ // we do allow retries.
+
+ Map attemptMap = new TreeMap();
+ for (McUsrAttempt attempt : listUserAttempts) {
+ attemptMap.put(attempt.getAttemptOrder(), attempt.getMcOptionsContent().getMcQueOptionText());
+ mcMonitoredUserDTO.setMark(attempt.getMarkForShow(mcSession.getMcContent().isRetries()));
+ mcMonitoredUserDTO.setIsCorrect(new Boolean(attempt.isAttemptCorrect()).toString());
}
-
- return listMonitoredUserContainerDTO;
+ mcMonitoredUserDTO.setUsersAttempts(attemptMap);
+ }
+
+ listMonitoredUserContainerDTO.add(mcMonitoredUserDTO);
+
}
- /**
- * @param request
- * @param mcService
- * @param mcContent
- */
- public static void setSessionUserCount(McContent mcContent, McGeneralMonitoringDTO mcGeneralMonitoringDTO)
- {
- int countSessionComplete=0;
- int countAllUsers=0;
- Iterator iteratorSession= mcContent.getMcSessions().iterator();
- while (iteratorSession.hasNext())
- {
- McSession mcSession=(McSession) iteratorSession.next();
-
- if (mcSession != null)
- {
-
- if (mcSession.getSessionStatus().equals(COMPLETED))
- {
- countSessionComplete++;
- }
- countAllUsers += mcSession.getMcQueUsers().size();
- }
+ return listMonitoredUserContainerDTO;
+ }
+
+ /**
+ * @param request
+ * @param mcService
+ * @param mcContent
+ */
+ public static void setSessionUserCount(McContent mcContent, McGeneralMonitoringDTO mcGeneralMonitoringDTO) {
+ int countSessionComplete = 0;
+ int countAllUsers = 0;
+ Iterator iteratorSession = mcContent.getMcSessions().iterator();
+ while (iteratorSession.hasNext()) {
+ McSession mcSession = (McSession) iteratorSession.next();
+
+ if (mcSession != null) {
+
+ if (mcSession.getSessionStatus().equals(COMPLETED)) {
+ countSessionComplete++;
}
-
- mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers));
- mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete));
-
- if ( countSessionComplete > 0 )
- mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(Boolean.FALSE.toString());
+ countAllUsers += mcSession.getMcQueUsers().size();
+ }
}
-
- /**
- *
- * @param mcService
- * @param mcContent
- * @return
- */
- public static boolean notebookEntriesExist(IMcService mcService, McContent mcContent)
- {
- Iterator iteratorSession= mcContent.getMcSessions().iterator();
- while (iteratorSession.hasNext())
- {
- McSession mcSession=(McSession) iteratorSession.next();
-
- if (mcSession != null)
- {
-
- Iterator iteratorUser=mcSession.getMcQueUsers().iterator();
- while (iteratorUser.hasNext())
- {
- McQueUsr mcQueUsr=(McQueUsr) iteratorUser.next();
-
- if (mcQueUsr != null)
- {
- NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
- CoreNotebookConstants.NOTEBOOK_TOOL,
- MY_SIGNATURE, new Integer(mcQueUsr.getQueUsrId().intValue()));
- if (notebookEntry != null)
- {
- return true;
- }
-
- }
- }
+ mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers));
+ mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete));
+
+ if (countSessionComplete > 0)
+ mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(Boolean.FALSE.toString());
+ }
+
+ /**
+ *
+ * @param mcService
+ * @param mcContent
+ * @return
+ */
+ public static boolean notebookEntriesExist(IMcService mcService, McContent mcContent) {
+ Iterator iteratorSession = mcContent.getMcSessions().iterator();
+ while (iteratorSession.hasNext()) {
+ McSession mcSession = (McSession) iteratorSession.next();
+
+ if (mcSession != null) {
+
+ Iterator iteratorUser = mcSession.getMcQueUsers().iterator();
+ while (iteratorUser.hasNext()) {
+ McQueUsr mcQueUsr = (McQueUsr) iteratorUser.next();
+
+ if (mcQueUsr != null) {
+ NotebookEntry notebookEntry = mcService.getEntry(mcSession.getMcSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(mcQueUsr.getQueUsrId()
+ .intValue()));
+ if (notebookEntry != null) {
+ return true;
+ }
+
}
}
- return false;
+ }
}
-
+ return false;
+ }
- /**
- * @param request
- * @param mcService
- * @param mcContent
- */
- public static void generateGroupsSessionData(HttpServletRequest request, IMcService mcService, McContent mcContent)
- {
- List listAllGroupsDTO=buildGroupBasedSessionData(request, mcContent, mcService);
- request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO);
- }
+ /**
+ * @param request
+ * @param mcService
+ * @param mcContent
+ */
+ public static void generateGroupsSessionData(HttpServletRequest request, IMcService mcService, McContent mcContent) {
+ List listAllGroupsDTO = buildGroupBasedSessionData(request, mcContent, mcService);
+ request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO);
+ }
+ /**
+ * @param request
+ * @param mcContent
+ * @param mcService
+ * @return
+ */
+ public static List buildGroupBasedSessionData(HttpServletRequest request, McContent mcContent, IMcService mcService) {
+ List listQuestions = mcService.getAllQuestionEntries(mcContent.getUid());
- /**
- * @param request
- * @param mcContent
- * @param mcService
- * @return
- */
- public static List buildGroupBasedSessionData(HttpServletRequest request, McContent mcContent, IMcService mcService)
- {
- List listQuestions=mcService.getAllQuestionEntries(mcContent.getUid());
-
- List listAllGroupsContainerDTO= new LinkedList();
-
-
- Iterator iteratorSession= mcContent.getMcSessions().iterator();
- while (iteratorSession.hasNext())
- {
- McSession mcSession=(McSession) iteratorSession.next();
- String currentSessionId=mcSession.getMcSessionId().toString();
-
- String currentSessionName=mcSession.getSession_name();
-
- McAllGroupsDTO mcAllGroupsDTO= new McAllGroupsDTO();
- List listMonitoredAnswersContainerDTO= new LinkedList();
-
- if (mcSession != null)
- {
- Iterator itListQuestions = listQuestions.iterator();
- while (itListQuestions.hasNext())
- {
- McQueContent mcQueContent =(McQueContent)itListQuestions.next();
-
- if (mcQueContent != null)
- {
- McMonitoredAnswersDTO mcMonitoredAnswersDTO= new McMonitoredAnswersDTO();
- mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
- mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
- mcMonitoredAnswersDTO.setSessionId(currentSessionId);
- mcMonitoredAnswersDTO.setSessionName(currentSessionName);
-
- Map questionAttemptData = new TreeMap();
-
- mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
-
- listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
- }
- }
+ List listAllGroupsContainerDTO = new LinkedList();
+
+ Iterator iteratorSession = mcContent.getMcSessions().iterator();
+ while (iteratorSession.hasNext()) {
+ McSession mcSession = (McSession) iteratorSession.next();
+ String currentSessionId = mcSession.getMcSessionId().toString();
+
+ String currentSessionName = mcSession.getSession_name();
+
+ McAllGroupsDTO mcAllGroupsDTO = new McAllGroupsDTO();
+ List listMonitoredAnswersContainerDTO = new LinkedList();
+
+ if (mcSession != null) {
+ Iterator itListQuestions = listQuestions.iterator();
+ while (itListQuestions.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) itListQuestions.next();
+
+ if (mcQueContent != null) {
+ McMonitoredAnswersDTO mcMonitoredAnswersDTO = new McMonitoredAnswersDTO();
+ mcMonitoredAnswersDTO.setQuestionUid(mcQueContent.getUid().toString());
+ mcMonitoredAnswersDTO.setQuestion(mcQueContent.getQuestion());
+ mcMonitoredAnswersDTO.setSessionId(currentSessionId);
+ mcMonitoredAnswersDTO.setSessionName(currentSessionName);
+
+ Map questionAttemptData = new TreeMap();
+
+ mcMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
+
+ listMonitoredAnswersContainerDTO.add(mcMonitoredAnswersDTO);
}
- mcAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO);
- mcAllGroupsDTO.setSessionName(currentSessionName);
- mcAllGroupsDTO.setSessionId(currentSessionId);
-
- listAllGroupsContainerDTO.add(mcAllGroupsDTO);
-
}
- return listAllGroupsContainerDTO;
- }
+ }
+ mcAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO);
+ mcAllGroupsDTO.setSessionName(currentSessionName);
+ mcAllGroupsDTO.setSessionId(currentSessionId);
-
+ listAllGroupsContainerDTO.add(mcAllGroupsDTO);
+
+ }
+ return listAllGroupsContainerDTO;
+ }
+
/**
- * Sets up auxiliary parameters. Used by all monitoring action methods.
+ * Sets up auxiliary parameters. Used by all monitoring action methods.
*
* @param request
* @param mcContent
@@ -529,7 +498,7 @@
request.setAttribute("reflectionSubject", mcContent.getReflectionSubject());
request.setAttribute("passMark", mcContent.getPassMark());
request.setAttribute("toolContentID", mcContent.getMcContentId());
-
+
// setting up Date and time restriction in activities
HttpSession ss = SessionManager.getSession();
Date submissionDeadline = mcContent.getSubmissionDeadline();