Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredAnswersDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredAnswersDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredAnswersDTO.java 3 Jan 2006 15:22:09 -0000 1.1 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McMonitoredAnswersDTO.java 7 Jan 2006 14:03:58 -0000 1.2 @@ -21,21 +21,28 @@ package org.lamsfoundation.lams.tool.mc; import java.util.List; +import java.util.Map; +import org.apache.commons.lang.builder.ToStringBuilder; + /** - *
DTO that holds monitored question and candiate answers data for jsp purposes + *
DTO that holds question/candidate answers data as well as user attempts data for jsp purposes *
* * @author Ozgur Demirtas */ -public class McMonitoredAnswersDTO +public class McMonitoredAnswersDTO implements Comparable { private String questionUid; private String question; private List candidateAnswers; + + private Map questionAttempts; + + /** * @return Returns the candidateAnswers. */ @@ -72,4 +79,34 @@ public void setQuestionUid(String questionUid) { this.questionUid = questionUid; } + + /** + * @return Returns the questionAttempts. + */ + public Map getQuestionAttempts() { + return questionAttempts; + } + /** + * @param questionAttempts The questionAttempts to set. + */ + public void setQuestionAttempts(Map questionAttempts) { + this.questionAttempts = questionAttempts; + } + + public String toString() { + return new ToStringBuilder(this) + .append("question", getQuestion()) + .toString(); + } + + public int compareTo(Object o) + { + McMonitoredAnswersDTO mcMonitoredAnswersDTO = (McMonitoredAnswersDTO) o; + + if (mcMonitoredAnswersDTO == null) + return 1; + else + return (int) (new Long(questionUid).longValue() - new Long(mcMonitoredAnswersDTO.questionUid).longValue()); + } + }