Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java,v diff -u -r1.14 -r1.14.8.1 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java 19 Feb 2009 23:59:13 -0000 1.14 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java 1 Nov 2010 10:30:02 -0000 1.14.8.1 @@ -62,6 +62,8 @@ private String feedback; + private boolean required; + /** nullable persistent field */ private org.lamsfoundation.lams.tool.qa.QaContent qaContent; @@ -78,9 +80,6 @@ private String otherResponse; /** nullable persistent field */ - private boolean isOptional; - - /** nullable persistent field */ private Long qaContentId; /** default constructor */ @@ -98,11 +97,12 @@ this.qaUsrResps = qaUsrResps; } - public QaQueContent(String question, int displayOrder, String feedback, + public QaQueContent(String question, int displayOrder, String feedback, boolean required, org.lamsfoundation.lams.tool.qa.QaContent qaContent, Set qaQueUsers, Set qaUsrResps) { this.question = question; this.displayOrder = displayOrder; this.feedback = feedback; + this.required = required; this.qaContent = qaContent; this.qaQueUsers = qaQueUsers; this.qaUsrResps = qaUsrResps; @@ -130,7 +130,7 @@ */ public static QaQueContent newInstance(QaQueContent queContent, QaContent newQaContent) { QaQueContent newQueContent = new QaQueContent(queContent.getQuestion(), queContent.getDisplayOrder(), - queContent.getFeedback(), newQaContent, new TreeSet(), new TreeSet()); + queContent.getFeedback(), queContent.isRequired(), newQaContent, new TreeSet(), new TreeSet()); return newQueContent; } @@ -162,13 +162,29 @@ } /** + * @param required + * Does this question have to be answered. + */ + public void setRequired(boolean required) { + this.required = required; + } + + /** + * @return Does this question have to be answered. + */ + public boolean isRequired() { + return required; + } + + /** * @param displayOrder * The displayOrder to set. */ public void setDisplayOrder(int displayOrder) { this.displayOrder = displayOrder; } + /** * @return Returns the qaContent. */ @@ -262,32 +278,6 @@ this.otherResponse = otherResponse; } - /** - * @hibernate.property column="isOptional" length="1" - * - */ - public boolean getIsOptional() { - return isOptional; - } - - public void setIsOptional(boolean isOptional) { - this.isOptional = isOptional; - } - - /** - * Validate whether there is a response available for current question. This - * method only validate struts convient field at the moment. - * - * @return whether the resonse is available or not. - */ - private boolean isResponseAvailable() { - if (this.getUserResponses().length == 0 && this.getOtherResponse() == null) { - return false; - } - return this.getUserResponses().length != 0 || !this.getOtherResponse().equals(""); - - } - public void setUpOtherResponse(String username) { for (Iterator i = this.getQaQueUsers().iterator(); i.hasNext();) { QaQueUsr qUser = (QaQueUsr) i.next(); @@ -316,7 +306,7 @@ } public int compareTo(Object o) { - QaQueContent queContent = (QaQueContent) o; + //QaQueContent queContent = (QaQueContent) o; // if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. /* @@ -356,14 +346,6 @@ } /** - * @param isOptional - * The isOptional to set. - */ - public void setOptional(boolean isOptional) { - this.isOptional = isOptional; - } - - /** * @return Returns the feedback. */ public String getFeedback() {