Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -185,7 +185,7 @@
lazy="true"
inverse="true"
cascade="all"
- sort="natural"
+ order-by="display_order"
>
+
+
+
+
+
mapQuestionContentLearner;
- protected Map mapQuestionContentLearner;
-
protected List listMonitoredAnswersContainerDTO;
protected String currentMonitoredToolSession;
@@ -163,15 +161,15 @@
/**
* @return Returns the mapQuestionContentLearner.
*/
- public Map getMapQuestionContentLearner() {
+ public Map getMapQuestionContentLearner() {
return mapQuestionContentLearner;
}
/**
* @param mapQuestionContentLearner
* The mapQuestionContentLearner to set.
*/
- public void setMapQuestionContentLearner(Map mapQuestionContentLearner) {
+ public void setMapQuestionContentLearner(Map mapQuestionContentLearner) {
this.mapQuestionContentLearner = mapQuestionContentLearner;
}
@@ -288,7 +286,7 @@
mapAnswers).append("mapQuestions: ", mapQuestions).append("mapQuestionContentLearner: ",
mapQuestionContentLearner).append("listMonitoredAnswersContainerDTO: ",
listMonitoredAnswersContainerDTO).append("currentMonitoredToolSession: ",
- currentMonitoredToolSession).append("mapFeedback: ", mapFeedback).toString();
+ currentMonitoredToolSession).toString();
}
/**
@@ -592,21 +590,6 @@
}
/**
- * @return Returns the mapFeedback.
- */
- public Map getMapFeedback() {
- return mapFeedback;
- }
-
- /**
- * @param mapFeedback
- * The mapFeedback to set.
- */
- public void setMapFeedback(Map mapFeedback) {
- this.mapFeedback = mapFeedback;
- }
-
- /**
* @return Returns the teacherViewOnly.
*/
public String getTeacherViewOnly() {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralMonitoringDTO.java
===================================================================
diff -u -r0db83894504dc7652d3670a6ce496605b961faa1 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralMonitoringDTO.java (.../GeneralMonitoringDTO.java) (revision 0db83894504dc7652d3670a6ce496605b961faa1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/GeneralMonitoringDTO.java (.../GeneralMonitoringDTO.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -53,8 +53,6 @@
protected String editResponse;
-
- protected Map mapQuestionContent;
protected String defaultQuestionContent;
protected String onlineInstructions;
@@ -76,7 +74,6 @@
.append("activityTitle: ", activityTitle)
.append("activityInstructions: ", activityInstructions)
.append("editResponse: ", editResponse)
- .append("mapQuestionContent: ", mapQuestionContent)
.append("defaultQuestionContent: ", defaultQuestionContent)
.append("countAllUsers: ", countAllUsers)
.append("countSessionComplete: ", countSessionComplete)
@@ -147,18 +144,6 @@
this.editResponse = editResponse;
}
/**
- * @return Returns the mapQuestionContent.
- */
- public Map getMapQuestionContent() {
- return mapQuestionContent;
- }
- /**
- * @param mapQuestionContent The mapQuestionContent to set.
- */
- public void setMapQuestionContent(Map mapQuestionContent) {
- this.mapQuestionContent = mapQuestionContent;
- }
- /**
* @return Returns the defaultQuestionContent.
*/
public String getDefaultQuestionContent() {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java
===================================================================
diff -u -r61e7bbf20d65e2ecb5e50f3154e52264003defa1 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 61e7bbf20d65e2ecb5e50f3154e52264003defa1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -22,6 +22,7 @@
*/
/* $$Id$$ */
+/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa;
/**
@@ -34,7 +35,6 @@
public static final long DEFAULT_QUE_CONTENT_ID = 1;
public static final String ERROR_QAAPPLICATION = "error.exception.QaApplication";
public static final String TOOL_CONTENT_ID = "toolContentID";
- public static final String MAP_QUESTION_CONTENT_KEY = "mapQuestionContentKey";
public static final String ATTACHMENT_LIST_KEY = "attachmentListKey";
public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey";
public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey";
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java (.../QaCondition.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaCondition.java (.../QaCondition.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -65,7 +65,7 @@
super(conditionDTO);
for (QaQueContent question : conditionDTO.getQuestions()) {
QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null,
- null, null, null);
+ question.isRequired(), null, null, null);
getQuestions().add(questionCopy);
}
}
@@ -136,7 +136,7 @@
for (QaQueContent question : getQuestions()) {
QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null,
- null, null, null);
+ question.isRequired(), null, null, null);
questionsCopy.add(questionCopy);
}
return new QaCondition(null, newConditionUIID, orderId, name, displayName, allWords, phrase, anyWords,
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java
===================================================================
diff -u -rd52e38e168a77a2c8b0e58dfdde7d1e73fcfda31 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java (.../QaConditionDTO.java) (revision d52e38e168a77a2c8b0e58dfdde7d1e73fcfda31)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java (.../QaConditionDTO.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -36,7 +36,7 @@
super(condition, toolActivityUIID);
for (QaQueContent question : condition.getQuestions()) {
QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null,
- null, null, null);
+ question.isRequired(), null, null, null);
getQuestions().add(questionCopy);
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (.../QaGeneralAuthoringDTO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (.../QaGeneralAuthoringDTO.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -66,7 +66,6 @@
protected String httpSessionID;
protected String requestedModule;
protected String isDefineLater;
- protected Map mapQuestionContent;
protected List attachmentList;
protected List deletedAttachmentList;
@@ -93,7 +92,7 @@
.append("editActivityEditMode: ", editActivityEditMode)
.append("reflectionSubject: ", reflectionSubject).append("requestedModule: ", requestedModule).append(
"isDefineLater: ", isDefineLater).append("monitoredContentInUse: ", monitoredContentInUse)
- .append("mapQuestionContent: ", mapQuestionContent).append("attachmentList: ", attachmentList).append(
+ .append("attachmentList: ", attachmentList).append(
"deletedAttachmentList: ", deletedAttachmentList).append("sbmtSuccess: ", sbmtSuccess).append(
"userExceptionQuestionsDuplicate: ", userExceptionQuestionsDuplicate).toString();
}
@@ -174,21 +173,6 @@
}
/**
- * @return Returns the mapQuestionContent.
- */
- public Map getMapQuestionContent() {
- return mapQuestionContent;
- }
-
- /**
- * @param mapQuestionContent
- * The mapQuestionContent to set.
- */
- public void setMapQuestionContent(Map mapQuestionContent) {
- this.mapQuestionContent = mapQuestionContent;
- }
-
- /**
* @return Returns the isDefineLater.
*/
public String getIsDefineLater() {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java (.../QaQueContent.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java (.../QaQueContent.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -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.
*/
@@ -263,18 +279,6 @@
}
/**
- * @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.
*
@@ -316,7 +320,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 +360,6 @@
}
/**
- * @param isOptional
- * The isOptional to set.
- */
- public void setOptional(boolean isOptional) {
- this.isOptional = isOptional;
- }
-
- /**
* @return Returns the feedback.
*/
public String getFeedback() {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestionContentDTO.java
===================================================================
diff -u -r0af4ed13b963a588f3499b080801863d57f8ad95 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestionContentDTO.java (.../QaQuestionContentDTO.java) (revision 0af4ed13b963a588f3499b080801863d57f8ad95)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestionContentDTO.java (.../QaQuestionContentDTO.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -36,13 +36,28 @@
private String question;
private String displayOrder;
private String feedback;
+ private boolean required;
@Override
public String toString() {
return new ToStringBuilder(this).append("question:", question).append("feedback:", feedback).append(
- "displayOrder:", displayOrder).toString();
+ "displayOrder:", displayOrder).append("required:", Boolean.toString(required)).toString();
}
+ public QaQuestionContentDTO(QaQueContent que) {
+ this.question = que.getQuestion();
+ this.displayOrder = new Integer(que.getDisplayOrder()).toString();
+ this.feedback = que.getFeedback() != null ? que.getFeedback() : " ";
+ this.required = que.isRequired();
+ }
+
+ public QaQuestionContentDTO(String question, String displayOrder, String feedback, boolean required) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.feedback = feedback;
+ this.required = required;
+ }
+
public int compareTo(Object o) {
QaMonitoredUserDTO qaMonitoredUserDTO = (QaMonitoredUserDTO) o;
@@ -98,6 +113,22 @@
this.question = question;
}
+ /**
+ * @return Is this question required?
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * @param required
+ * Is this question required
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+
@Override
public boolean equals(Object o) {
if (o instanceof QaQuestionContentDTO) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -86,11 +86,6 @@
public static void setFormProperties(HttpServletRequest request, IQaService qaService,
QaAuthoringForm qaAuthoringForm, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, String strToolContentID,
String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) {
- logger.debug("setFormProperties: ");
- logger.debug("using strToolContentID: " + strToolContentID);
- logger.debug("using defaultContentIdStr: " + defaultContentIdStr);
- logger.debug("using activeModule: " + activeModule);
- logger.debug("using httpSessionID: " + httpSessionID);
qaAuthoringForm.setHttpSessionID(httpSessionID);
qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
@@ -104,27 +99,22 @@
qaGeneralAuthoringDTO.setActiveModule(activeModule);
String synchInMonitor = request.getParameter(SYNC_IN_MONITOR);
- logger.debug("synchInMonitor: " + synchInMonitor);
qaAuthoringForm.setSynchInMonitor(synchInMonitor);
qaGeneralAuthoringDTO.setSynchInMonitor(synchInMonitor);
String usernameVisible = request.getParameter(USERNAME_VISIBLE);
- logger.debug("usernameVisible: " + usernameVisible);
qaAuthoringForm.setUsernameVisible(usernameVisible);
qaGeneralAuthoringDTO.setUsernameVisible(usernameVisible);
String showOtherAnswers = request.getParameter("showOtherAnswers");
- logger.debug("showOtherAnswers: " + showOtherAnswers);
qaAuthoringForm.setShowOtherAnswers(showOtherAnswers);
qaGeneralAuthoringDTO.setShowOtherAnswers(showOtherAnswers);
String questionsSequenced = request.getParameter(QUESTIONS_SEQUENCED);
- logger.debug("questionsSequenced: " + questionsSequenced);
qaAuthoringForm.setQuestionsSequenced(questionsSequenced);
qaGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced);
String lockWhenFinished = request.getParameter("lockWhenFinished");
- logger.debug("lockWhenFinished: " + lockWhenFinished);
qaAuthoringForm.setLockWhenFinished(lockWhenFinished);
qaGeneralAuthoringDTO.setLockWhenFinished(lockWhenFinished);
@@ -156,7 +146,6 @@
HttpSession ss = SessionManager.getSession();
/* get back login user DTO */
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- logger.debug(logger + " " + "QaUtils" + " Current user id: " + user.getUserID());
return user.getUserID().intValue();
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r0bd4172f8706e62f7f834ad0e01e4affde8e1ba3 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 0bd4172f8706e62f7f834ad0e01e4affde8e1ba3)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -107,24 +107,21 @@
while (listIterator.hasNext()) {
QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
queIndex++;
- QaQuestionContentDTO tempNode = new QaQuestionContentDTO();
-
+ QaQuestionContentDTO tempNode = null;
+
if (!qaQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())
&& !qaQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
AuthoringUtil.logger.debug("normal copy ");
- tempNode.setQuestion(qaQuestionContentDTO.getQuestion());
- tempNode.setDisplayOrder(qaQuestionContentDTO.getDisplayOrder());
- tempNode.setFeedback(qaQuestionContentDTO.getFeedback());
+ tempNode = new QaQuestionContentDTO(qaQuestionContentDTO.getQuestion(),
+ qaQuestionContentDTO.getDisplayOrder(), qaQuestionContentDTO.getFeedback(), qaQuestionContentDTO.isRequired());
} else if (qaQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) {
AuthoringUtil.logger.debug("move type 1 ");
- tempNode.setQuestion(replacedNode.getQuestion());
- tempNode.setDisplayOrder(replacedNode.getDisplayOrder());
- tempNode.setFeedback(replacedNode.getFeedback());
+ tempNode = new QaQuestionContentDTO(replacedNode.getQuestion(),
+ replacedNode.getDisplayOrder(),replacedNode.getFeedback(), replacedNode.isRequired());
} else if (qaQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
AuthoringUtil.logger.debug("move type 1 ");
- tempNode.setQuestion(mainNode.getQuestion());
- tempNode.setDisplayOrder(mainNode.getDisplayOrder());
- tempNode.setFeedback(mainNode.getFeedback());
+ tempNode = new QaQuestionContentDTO(mainNode.getQuestion(),
+ mainNode.getDisplayOrder(), mainNode.getFeedback(), mainNode.isRequired());
}
listFinalQuestionContentDTO.add(tempNode);
@@ -161,35 +158,7 @@
}
return null;
}
-
- protected static Map extractMapQuestionContent(List listQuestionContentDTO) {
- Map mapQuestionContent = new TreeMap(new QaComparator());
-
- Iterator listIterator = listQuestionContentDTO.iterator();
- int queIndex = 0;
- while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
- queIndex++;
- AuthoringUtil.logger.debug("Populating question map with key=" + queIndex + " value=" + qaQuestionContentDTO.getQuestion());
- mapQuestionContent.put(new Integer(queIndex).toString(), qaQuestionContentDTO.getQuestion());
- }
- return mapQuestionContent;
- }
-
- protected static Map extractMapFeedback(List listQuestionContentDTO) {
- Map mapFeedbackContent = new TreeMap(new QaComparator());
-
- Iterator listIterator = listQuestionContentDTO.iterator();
- int queIndex = 0;
- while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
- queIndex++;
- AuthoringUtil.logger.debug("Populating feedback map with key=" + queIndex + " value=" + qaQuestionContentDTO.getFeedback());
- mapFeedbackContent.put(new Integer(queIndex).toString(), qaQuestionContentDTO.getFeedback());
- }
- return mapFeedbackContent;
- }
-
+
protected static Map reorderQuestionContentMap(Map mapQuestionContent) {
Map mapFinalQuestionContent = new TreeMap(new QaComparator());
@@ -224,6 +193,7 @@
AuthoringUtil.logger.debug("displayOrder:" + displayOrder);
String feedback = qaQuestionContentDTO.getFeedback();
+ boolean required = qaQuestionContentDTO.isRequired();
AuthoringUtil.logger.debug("displayOrder versus excludeQuestionIndex :" + displayOrder + " versus "
+ excludeQuestionIndex);
@@ -235,6 +205,7 @@
qaQuestionContentDTO.setQuestion(question);
qaQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString());
qaQuestionContentDTO.setFeedback(feedback);
+ qaQuestionContentDTO.setRequired(required);
listFinalQuestionContentDTO.add(qaQuestionContentDTO);
}
@@ -253,17 +224,17 @@
QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
String question = qaQuestionContentDTO.getQuestion();
-
String displayOrder = qaQuestionContentDTO.getDisplayOrder();
+ String feedback = qaQuestionContentDTO.getFeedback();
+ boolean required = qaQuestionContentDTO.isRequired();
- String feedback = qaQuestionContentDTO.getFeedback();
-
if (question != null && !question.equals("")) {
++queIndex;
qaQuestionContentDTO.setQuestion(question);
qaQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString());
qaQuestionContentDTO.setFeedback(feedback);
+ qaQuestionContentDTO.setRequired(required);
listFinalQuestionContentDTO.add(qaQuestionContentDTO);
}
@@ -286,21 +257,22 @@
++queIndex;
String question = qaQuestionContentDTO.getQuestion();
-
String displayOrder = qaQuestionContentDTO.getDisplayOrder();
-
String feedback = qaQuestionContentDTO.getFeedback();
-
+ boolean required = qaQuestionContentDTO.isRequired();
+
if (displayOrder.equals(editableQuestionIndex)) {
qaQuestionContentDTO.setQuestion(qaQuestionContentDTONew.getQuestion());
qaQuestionContentDTO.setDisplayOrder(qaQuestionContentDTONew.getDisplayOrder());
qaQuestionContentDTO.setFeedback(qaQuestionContentDTONew.getFeedback());
+ qaQuestionContentDTO.setRequired(required);
listFinalQuestionContentDTO.add(qaQuestionContentDTO);
} else {
qaQuestionContentDTO.setQuestion(question);
qaQuestionContentDTO.setDisplayOrder(displayOrder);
qaQuestionContentDTO.setFeedback(feedback);
+ qaQuestionContentDTO.setRequired(required);
listFinalQuestionContentDTO.add(qaQuestionContentDTO);
@@ -333,7 +305,7 @@
}
}
- public QaContent saveOrUpdateQaContent(Map mapQuestionContent, Map mapFeedback, IQaService qaService,
+ public QaContent saveOrUpdateQaContent(List listQuestionContentDTO, IQaService qaService,
QaAuthoringForm qaAuthoringForm, HttpServletRequest request, QaContent qaContent, String strToolContentID,
Set conditions) {
UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER);
@@ -452,7 +424,7 @@
}
qaContent = qaService.loadQa(new Long(strToolContentID).longValue());
- qaContent = createQuestionContent(mapQuestionContent, mapFeedback, qaService, qaContent, conditions);
+ qaContent = createQuestionContent(listQuestionContentDTO, qaService, qaContent, conditions);
qaContent = qaService.loadQa(new Long(strToolContentID).longValue());
@@ -480,7 +452,7 @@
* @param qaService
* @param qaAuthoringForm
*/
- public void removeRedundantQuestions(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm,
+ public void removeRedundantQuestions(ListlistQuestionContentDTO, IQaService qaService, QaAuthoringForm qaAuthoringForm,
HttpServletRequest request, String toolContentID) {
AuthoringUtil.logger.debug("removing unused entries... ");
AuthoringUtil.logger.debug("toolContentID: " + toolContentID);
@@ -501,23 +473,10 @@
AuthoringUtil.logger.info("Checking whether to remove question with id=" + queContent.getUid() + ", displayOrder=" + queContent.getDisplayOrder() + ", question=" + queContent.getQuestion());
entryUsed = false;
- Iterator itMap = mapQuestionContent.entrySet().iterator();
int displayOrder = 0;
- while (itMap.hasNext()) {
+ for ( QaQuestionContentDTO questionDTO : listQuestionContentDTO ) {
++displayOrder;
-
- entryUsed = false;
- Map.Entry pairs = (Map.Entry) itMap.next();
- AuthoringUtil.logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
- /*
- if (pairs.getValue().toString().length() != 0) {
- if (mapIndex == displayOrder) {
- entryUsed = true;
- break;
- }
- }
- */
- if (StringUtils.equals(queContent.getQuestion(), pairs.getValue().toString())) {
+ if (StringUtils.equals(queContent.getQuestion(), questionDTO.getQuestion())) {
entryUsed = true;
break;
}
@@ -549,49 +508,38 @@
* their displayOrder fields haven't been updated yet. Note also that the given
* mapQuestionContent maps question numbers to question strings.
*/
- protected QaContent createQuestionContent(Map mapQuestionContent, Map mapFeedback, IQaService qaService,
+ protected QaContent createQuestionContent(List listQuestionContentDTO, IQaService qaService,
QaContent qaContent, Set conditions) {
- AuthoringUtil.logger.debug("createQuestionContent: ");
- AuthoringUtil.logger.debug("content uid is: " + qaContent.getUid());
- List questions = qaService.retrieveQaQueContentsByToolContentId(qaContent.getUid().longValue());
+ AuthoringUtil.logger.debug("createQuestionContent: content uid is: " + qaContent.getUid());
- Iterator itMap = mapQuestionContent.entrySet().iterator();
int displayOrder = 0;
- while (itMap.hasNext()) {
- Map.Entry pairs = (Map.Entry) itMap.next();
+ for ( QaQuestionContentDTO questionContentDTO : listQuestionContentDTO ) {
// LDEV-2526 Assuming here that removed questions exist in mapQuestionContent, but that the value is empty
// (this whole thing needs a rewrite). If empty, do not attempt to persist it.
- if (StringUtils.isNotBlank(pairs.getValue().toString())) {
- AuthoringUtil.logger.info("Persisting question with key=" + pairs.getKey() + " and value=" + pairs.getValue());
+ // LDEV-2524 Partial rewrite - removed the old question and feedback maps and just use the original list.
+ // Overriding the displayOrder with a new displayOrder.
+ String questionText = questionContentDTO.getQuestion();
+ if (StringUtils.isNotBlank(questionText)) {
+ AuthoringUtil.logger.info("Persisting question with key=" + questionText);
- //++displayOrder;
- displayOrder = new Integer(pairs.getKey().toString());
+ ++displayOrder;
- String currentFeedback = (String) mapFeedback.get(new Integer(displayOrder).toString());
-
- //QaQueContent existingQaQueContent = qaService.getQuestionContentByDisplayOrder(new Long(displayOrder),
- // qaContent.getUid());
- QaQueContent existingQaQueContent = qaService.getQuestionContentByQuestionText(pairs.getValue()
- .toString(), qaContent.getUid());
-
+ QaQueContent existingQaQueContent = qaService.getQuestionContentByQuestionText(questionText, qaContent.getUid());
if (existingQaQueContent == null) {
- //QaQueContent duplicateQaQueContent = qaService.getQuestionContentByQuestionText(pairs.getValue()
- // .toString(), qaContent.getUid());
- QaQueContent queContent = new QaQueContent(pairs.getValue().toString(), displayOrder, currentFeedback,
- qaContent, null, null);
+ QaQueContent queContent = new QaQueContent(questionText, displayOrder, questionContentDTO.getFeedback(),
+ questionContentDTO.isRequired(), qaContent, null, null);
qaContent.getQaQueContents().add(queContent);
queContent.setQaContent(qaContent);
AuthoringUtil.logger.info("Creating new question with question=" + queContent.getQuestion() + ", displayOrder=" + queContent.getDisplayOrder());
qaService.createQaQue(queContent);
} else {
- String existingQuestion = existingQaQueContent.getQuestion();
-
- existingQaQueContent.setQuestion(pairs.getValue().toString());
- existingQaQueContent.setFeedback(currentFeedback);
+ existingQaQueContent.setQuestion(questionText);
+ existingQaQueContent.setFeedback(questionContentDTO.getFeedback());
existingQaQueContent.setDisplayOrder(displayOrder);
+ existingQaQueContent.setRequired(questionContentDTO.isRequired());
AuthoringUtil.logger.info("Updating question with id=" + existingQaQueContent.getUid() + ", question=" + existingQaQueContent.getQuestion() + ", displayOrder=" + existingQaQueContent.getDisplayOrder());
qaService.saveOrUpdateQaQueContent(existingQaQueContent);
}
@@ -601,18 +549,11 @@
return qaContent;
}
- public static boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) {
+ public static boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) {
AuthoringUtil.logger.debug("checkDuplicateQuestions: ");
-
- Map mapQuestionContent = extractMapQuestionContent(listQuestionContentDTO);
-
- Iterator itMap = mapQuestionContent.entrySet().iterator();
- while (itMap.hasNext()) {
- Map.Entry pairs = (Map.Entry) itMap.next();
- if (pairs.getValue() != null && !pairs.getValue().equals("")) {
- if (pairs.getValue().equals(newQuestion)) {
- return true;
- }
+ for (QaQuestionContentDTO questionDTO : listQuestionContentDTO ) {
+ if ( questionDTO.getQuestion() != null && questionDTO.getQuestion().equals(newQuestion) ) {
+ return true;
}
}
return false;
@@ -628,7 +569,7 @@
* @param qaAuthoringForm
* @param qaContent
*/
- public void reOrganizeDisplayOrder(Map mapQuestionContent, IQaService qaService, QaAuthoringForm qaAuthoringForm,
+ public void reOrganizeDisplayOrder(IQaService qaService, QaAuthoringForm qaAuthoringForm,
QaContent qaContent) {
if (qaContent != null) {
AuthoringUtil.logger.debug("content uid: " + qaContent.getUid());
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -40,6 +40,7 @@
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.QaQueUsr;
+import org.lamsfoundation.lams.tool.qa.QaQuestionContentDTO;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
import org.lamsfoundation.lams.tool.qa.QaUtils;
@@ -90,11 +91,11 @@
generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString());
generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString());
generalLearnerFlowDTO.setActivityOffline(new Boolean(qaContent.isRunOffline()).toString());
-
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(qaContent.isAllowRichEditor()).toString());
+
generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQueContents().size()));
- Map mapQuestions = new TreeMap(new QaComparator());
- Map mapFeedback = new TreeMap(new QaComparator());
+ Map mapQuestions = new TreeMap();
Iterator contentIterator = qaContent.getQaQueContents().iterator();
while (contentIterator.hasNext()) {
@@ -105,18 +106,12 @@
/*
* add the question to the questions Map in the displayOrder
*/
- mapQuestions.put(new Integer(displayOrder).toString(), qaQueContent.getQuestion());
-
- String feedback = qaQueContent.getFeedback();
- if (feedback == null)
- feedback = "";
-
- mapFeedback.put(new Integer(displayOrder).toString(), feedback.trim());
+ QaQuestionContentDTO questionDTO = new QaQuestionContentDTO(qaQueContent);
+ mapQuestions.put(questionDTO.getDisplayOrder(), questionDTO );
}
}
}
- generalLearnerFlowDTO.setMapFeedback(mapFeedback);
generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions);
return generalLearnerFlowDTO;
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java
===================================================================
diff -u -r0bd4172f8706e62f7f834ad0e01e4affde8e1ba3 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 0bd4172f8706e62f7f834ad0e01e4affde8e1ba3)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAction.java (.../QaAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -27,6 +27,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -231,15 +232,11 @@
String defaultContentIdStr = request.getParameter(QaAppConstants.DEFAULT_CONTENT_ID_STR);
- List listQuestionContentDTO = (List) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
+ List listQuestionContentDTO = (List) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
- Map mapQuestionContent = AuthoringUtil.extractMapQuestionContent(listQuestionContentDTO);
-
- Map mapFeedback = AuthoringUtil.extractMapFeedback(listQuestionContentDTO);
-
ActionMessages errors = new ActionMessages();
- if (mapQuestionContent.size() == 0) {
+ if (listQuestionContentDTO.size() == 0) {
ActionMessage error = new ActionMessage("questions.none.submitted");
errors.add(ActionMessages.GLOBAL_MESSAGE, error);
}
@@ -287,8 +284,6 @@
sessionMap.put(QaAppConstants.ACTIVITY_TITLE_KEY, richTextTitle);
sessionMap.put(QaAppConstants.ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
-
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
@@ -305,11 +300,11 @@
/*
* to remove deleted entries in the questions table based on mapQuestionContent
*/
- authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request,
+ authoringUtil.removeRedundantQuestions(listQuestionContentDTO, qaService, qaAuthoringForm, request,
strToolContentID);
QaAction.logger.debug("end of removing unused entries... ");
- qaContent = authoringUtil.saveOrUpdateQaContent(mapQuestionContent, mapFeedback, qaService,
+ qaContent = authoringUtil.saveOrUpdateQaContent(listQuestionContentDTO, qaService,
qaAuthoringForm, request, qaContentTest, strToolContentID, conditionSet);
long defaultContentID = 0;
@@ -321,44 +316,30 @@
qaGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
}
- authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent);
+ authoringUtil.reOrganizeDisplayOrder(qaService, qaAuthoringForm, qaContent);
- QaAction.logger.debug("activeModule: " + activeModule);
if (activeModule.equals(QaAppConstants.AUTHORING)) {
List attachmentList = (List) sessionMap.get(QaAppConstants.ATTACHMENT_LIST_KEY);
- QaAction.logger.debug("attachmentList: " + attachmentList);
-
List deletedAttachmentList = (List) sessionMap.get(QaAppConstants.DELETED_ATTACHMENT_LIST_KEY);
-
List attachments = saveAttachments(qaContent, attachmentList, deletedAttachmentList, mapping, request);
- QaAction.logger.debug("attachments: " + attachments);
}
- QaAction.logger.debug("strToolContentID: " + strToolContentID);
QaUtils.setDefineLater(request, false, strToolContentID, qaService);
- QaAction.logger.debug("define later set to false");
-
QaUtils.setFormProperties(request, qaService, qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID,
defaultContentIdStr, activeModule, sessionMap, httpSessionID);
if (activeModule.equals(QaAppConstants.AUTHORING)) {
- QaAction.logger.debug("standard authoring close");
request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
} else {
- QaAction.logger.debug("go back to view only screen");
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString());
}
} else {
- QaAction.logger.debug("errors is not empty: " + errors);
-
if (qaContent != null) {
long defaultContentID = 0;
- QaAction.logger.debug("attempt retrieving tool with signatute : " + QaAppConstants.MY_SIGNATURE);
defaultContentID = qaService.getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE);
- QaAction.logger.debug("retrieved tool default contentId: " + defaultContentID);
if (qaContent != null) {
qaGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString());
@@ -381,7 +362,6 @@
qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString());
qaAuthoringForm.resetUserAction();
- qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
@@ -458,6 +438,12 @@
String editableQuestionIndex = request.getParameter("editableQuestionIndex");
+ String required = request.getParameter("required");
+ boolean requiredBoolean = false;
+ if (required != null && required.equalsIgnoreCase("1")) {
+ requiredBoolean = true;
+ }
+
if (newQuestion != null && newQuestion.length() > 0) {
if (editQuestionBoxRequest != null && editQuestionBoxRequest.equals("false")) {
QaAction.logger.debug("request for add and save");
@@ -485,6 +471,7 @@
qaQuestionContentDTO.setQuestion(newQuestion);
qaQuestionContentDTO.setFeedback(feedback);
qaQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ qaQuestionContentDTO.setRequired(requiredBoolean);
listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO,
qaQuestionContentDTO, editableQuestionIndex);
@@ -512,6 +499,7 @@
qaQuestionContentDTO.setQuestion(newQuestion);
qaQuestionContentDTO.setFeedback(feedback);
qaQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ qaQuestionContentDTO.setRequired(requiredBoolean);
listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO,
qaQuestionContentDTO, editableQuestionIndex);
@@ -578,14 +566,8 @@
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
-
- QaAction.logger.debug("httpSessionID: " + httpSessionID);
-
request.getSession().setAttribute(httpSessionID, sessionMap);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -631,20 +613,21 @@
List listQuestionContentDTO = (List) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
String newQuestion = request.getParameter("newQuestion");
-
String feedback = request.getParameter("feedback");
+ String required = request.getParameter("required");
+ boolean requiredBoolean = false;
+ if (required != null && required.equalsIgnoreCase("1")) {
+ requiredBoolean = true;
+ }
int listSize = listQuestionContentDTO.size();
if (newQuestion != null && newQuestion.length() > 0) {
boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion);
if (!duplicates) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
- qaQuestionContentDTO.setDisplayOrder(new Long(listSize + 1).toString());
- qaQuestionContentDTO.setFeedback(feedback);
- qaQuestionContentDTO.setQuestion(newQuestion);
-
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(newQuestion, new Long(listSize + 1).toString(),
+ feedback, requiredBoolean);
listQuestionContentDTO.add(qaQuestionContentDTO);
} else {
QaAction.logger.debug("entry duplicate, not adding");
@@ -667,8 +650,6 @@
sessionMap.put(QaAppConstants.ACTIVITY_TITLE_KEY, richTextTitle);
sessionMap.put(QaAppConstants.ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
-
- QaAction.logger.debug("activeModule: " + activeModule);
if (activeModule.equals(QaAppConstants.AUTHORING)) {
String onlineInstructions = (String) sessionMap.get(QaAppConstants.ONLINE_INSTRUCTIONS_KEY);
qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
@@ -709,14 +690,8 @@
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
-
- QaAction.logger.debug("httpSessionID: " + httpSessionID);
-
request.getSession().setAttribute(httpSessionID, sessionMap);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -769,8 +744,6 @@
QaUtils.setFormProperties(request, qaService, qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID,
defaultContentIdStr, activeModule, sessionMap, httpSessionID);
-
- QaAction.logger.debug("activeModule: " + activeModule);
if (activeModule.equals(QaAppConstants.AUTHORING)) {
String strOnlineInstructions = request.getParameter("onlineInstructions");
String strOfflineInstructions = request.getParameter("offlineInstructions");
@@ -782,7 +755,7 @@
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
- List listQuestionContentDTO = (List) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
+ Collection listQuestionContentDTO = (Collection) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
@@ -793,7 +766,6 @@
request.setAttribute(QaAppConstants.ATTR_WIZARD_CATEGORIES, qaService.getWizardCategories());
}
- QaAction.logger.debug("fwd ing to newQuestionBox: ");
return mapping.findForward("newQuestionBox");
}
@@ -806,7 +778,6 @@
* @param request
* @param response
* @return
- * @throws IOException
* @throws ServletException
*/
public ActionForward newEditableQuestionBox(ActionMapping mapping, ActionForm form, HttpServletRequest request,
@@ -828,6 +799,7 @@
String editableQuestion = "";
String editableFeedback = "";
+ boolean requiredBoolean = false;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
@@ -838,6 +810,7 @@
if (displayOrder.equals(questionIndex)) {
editableFeedback = qaQuestionContentDTO.getFeedback();
editableQuestion = qaQuestionContentDTO.getQuestion();
+ requiredBoolean = qaQuestionContentDTO.isRequired();
break;
}
@@ -872,6 +845,7 @@
qaGeneralAuthoringDTO.setEditableQuestionText(editableQuestion);
qaGeneralAuthoringDTO.setEditableQuestionFeedback(editableFeedback);
+ qaAuthoringForm.setRequired(requiredBoolean);
qaAuthoringForm.setFeedback(editableFeedback);
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
@@ -880,15 +854,13 @@
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
- QaAction.logger.debug("activeModule: " + activeModule);
if (activeModule.equals(QaAppConstants.AUTHORING)) {
String strOnlineInstructions = request.getParameter("onlineInstructions");
String strOfflineInstructions = request.getParameter("offlineInstructions");
qaAuthoringForm.setOnlineInstructions(strOnlineInstructions);
qaAuthoringForm.setOfflineInstructions(strOfflineInstructions);
}
- QaAction.logger.debug("fwd ing to editQuestionBox: ");
return mapping.findForward("editQuestionBox");
}
@@ -1036,10 +1008,7 @@
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -1148,10 +1117,7 @@
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -1260,10 +1226,7 @@
qaGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString());
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -1371,8 +1334,6 @@
qaAuthoringForm.setOfflineInstructions(strOfflineInstructions);
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
-
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -1485,8 +1446,6 @@
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
qaAuthoringForm.resetUserAction();
- QaAction.logger.debug("fwd ing to LOAD_QUESTIONS: " + QaAppConstants.LOAD_QUESTIONS);
-
return mapping.findForward(QaAppConstants.LOAD_QUESTIONS);
}
@@ -1501,7 +1460,6 @@
public void persistError(HttpServletRequest request, String message) {
ActionMessages errors = new ActionMessages();
errors.add(Globals.ERROR_KEY, new ActionMessage(message));
- QaAction.logger.debug("add " + message + " to ActionMessages:");
saveErrors(request, errors);
}
@@ -1833,14 +1791,11 @@
Iterator queIterator = qaContent.getQaQueContents().iterator();
while (queIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
-
QaQueContent qaQueContent = (QaQueContent) queIterator.next();
- if (qaQueContent != null) {
- qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion());
+ if (qaQueContent != null) {
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(qaQueContent);
qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString());
- qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback());
listQuestionContentDTO.add(qaQuestionContentDTO);
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -91,11 +91,11 @@
private String addSingleQuestion;
private String editableQuestionIndex;
private String feedback;
+ private boolean required;
private String editQuestionBoxRequest;
protected String defineLaterInEditMode;
protected String defaultContentIdStr;
- protected Map mapQuestionContent;
protected IQaService qaService;
protected boolean allowRichEditor;
@@ -164,6 +164,7 @@
this.lockWhenFinished = OPTION_OFF;
this.reflect = OPTION_OFF;
this.allowRichEditor = false;
+ this.required = false;
}
public String toString() {
@@ -720,21 +721,6 @@
}
/**
- * @return Returns the mapQuestionContent.
- */
- public Map getMapQuestionContent() {
- return mapQuestionContent;
- }
-
- /**
- * @param mapQuestionContent
- * The mapQuestionContent to set.
- */
- public void setMapQuestionContent(Map mapQuestionContent) {
- this.mapQuestionContent = mapQuestionContent;
- }
-
- /**
* @return Returns the defineLaterInEditMode.
*/
public String getDefineLaterInEditMode() {
@@ -891,4 +877,12 @@
public void setAllowRichEditor(boolean allowRichEditor) {
this.allowRichEditor = allowRichEditor;
}
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -52,6 +52,7 @@
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.QaQueUsr;
+import org.lamsfoundation.lams.tool.qa.QaQuestionContentDTO;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
@@ -171,7 +172,8 @@
IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
/* holds the question contents for a given tool session and relevant content */
- Map mapQuestions = new TreeMap(new QaComparator());
+ Map mapQuestionStrings = new TreeMap(new QaComparator());
+ Map mapQuestions = new TreeMap();
/*holds the answers */
Map mapAnswers = new TreeMap(new QaComparator());
@@ -318,11 +320,15 @@
/*
* add the question to the questions Map in the displayOrder
*/
- mapQuestions.put(new Integer(displayOrder).toString(), qaQueContent.getQuestion());
+ QaQuestionContentDTO questionDTO = new QaQuestionContentDTO(qaQueContent);
+ mapQuestions.put(questionDTO.getDisplayOrder(), questionDTO);
+
+ mapQuestionStrings.put(new Integer(displayOrder).toString(), qaQueContent.getQuestion());
+
}
}
}
- generalLearnerFlowDTO.setMapQuestions(mapQuestions);
+ generalLearnerFlowDTO.setMapQuestions(mapQuestionStrings);
generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions);
Iterator itMapQuestions = mapQuestions.entrySet().iterator();
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -100,6 +100,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -674,19 +675,14 @@
Iterator queIterator = qaContent.getQaQueContents().iterator();
while (queIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
-
QaQueContent qaQueContent = (QaQueContent) queIterator.next();
if (qaQueContent != null) {
- qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion());
- qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString());
- qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback());
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(qaQueContent);
listQuestionContentDTO.add(qaQuestionContentDTO);
}
}
request.setAttribute(QaAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
-
request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO) request
@@ -2147,18 +2143,11 @@
QaMonitoringAction.logger.debug("defaultContentIdStr: " + defaultContentIdStr);
List listQuestionContentDTO = (List) sessionMap.get(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY);
-
- Map mapQuestionContent = AuthoringUtil.extractMapQuestionContent(listQuestionContentDTO);
-
-
- Map mapFeedback = AuthoringUtil.extractMapFeedback(listQuestionContentDTO);
-
-
ActionMessages errors = new ActionMessages();
- QaMonitoringAction.logger.debug("mapQuestionContent size: " + mapQuestionContent.size());
+ QaMonitoringAction.logger.debug("listQuestionContentDTO size: " + listQuestionContentDTO.size());
- if (mapQuestionContent.size() == 0) {
+ if (listQuestionContentDTO.size() == 0) {
ActionMessage error = new ActionMessage("questions.none.submitted");
errors.add(ActionMessages.GLOBAL_MESSAGE, error);
}
@@ -2180,7 +2169,6 @@
sessionMap.put(QaAppConstants.ACTIVITY_TITLE_KEY, richTextTitle);
sessionMap.put(QaAppConstants.ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions);
- qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
QaMonitoringAction.logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO);
QaMonitoringAction.logger.debug("qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO);
@@ -2202,11 +2190,11 @@
/*
* to remove deleted entries in the questions table based on mapQuestionContent
*/
- authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request,
+ authoringUtil.removeRedundantQuestions(listQuestionContentDTO, qaService, qaAuthoringForm, request,
strToolContentID);
QaMonitoringAction.logger.debug("end of removing unused entries... ");
- qaContent = authoringUtil.saveOrUpdateQaContent(mapQuestionContent, mapFeedback, qaService,
+ qaContent = authoringUtil.saveOrUpdateQaContent(listQuestionContentDTO, qaService,
qaAuthoringForm, request, qaContentTest, strToolContentID, null);
@@ -2220,7 +2208,7 @@
}
- authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent);
+ authoringUtil.reOrganizeDisplayOrder(qaService, qaAuthoringForm, qaContent);
QaMonitoringAction.logger.debug("strToolContentID: " + strToolContentID);
QaUtils.setDefineLater(request, false, strToolContentID, qaService);
@@ -2254,8 +2242,6 @@
qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString());
qaAuthoringForm.resetUserAction();
- qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
-
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
@@ -2380,10 +2366,12 @@
String newQuestion = request.getParameter("newQuestion");
-
-
String feedback = request.getParameter("feedback");
-
+ String required = request.getParameter("required");
+ boolean requiredBoolean = false;
+ if (required != null && required.equalsIgnoreCase("1")) {
+ requiredBoolean = true;
+ }
String editableQuestionIndex = request.getParameter("editableQuestionIndex");
QaMonitoringAction.logger.debug("editableQuestionIndex: " + editableQuestionIndex);
@@ -2415,6 +2403,7 @@
qaQuestionContentDTO.setQuestion(newQuestion);
qaQuestionContentDTO.setFeedback(feedback);
qaQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ qaQuestionContentDTO.setRequired(requiredBoolean);
listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO,
qaQuestionContentDTO, editableQuestionIndex);
@@ -2444,6 +2433,7 @@
qaQuestionContentDTO.setQuestion(newQuestion);
qaQuestionContentDTO.setFeedback(feedback);
qaQuestionContentDTO.setDisplayOrder(editableQuestionIndex);
+ qaQuestionContentDTO.setRequired(requiredBoolean);
listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO,
qaQuestionContentDTO, editableQuestionIndex);
@@ -2600,10 +2590,12 @@
String newQuestion = request.getParameter("newQuestion");
-
-
String feedback = request.getParameter("feedback");
-
+ String required = request.getParameter("required");
+ boolean requiredBoolean = false;
+ if (required != null && required.equalsIgnoreCase("1")) {
+ requiredBoolean = true;
+ }
int listSize = listQuestionContentDTO.size();
@@ -2613,11 +2605,8 @@
QaMonitoringAction.logger.debug("duplicates: " + duplicates);
if (!duplicates) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
- qaQuestionContentDTO.setDisplayOrder(new Long(listSize + 1).toString());
- qaQuestionContentDTO.setFeedback(feedback);
- qaQuestionContentDTO.setQuestion(newQuestion);
-
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(newQuestion,
+ new Long(listSize + 1).toString(), feedback, requiredBoolean);
listQuestionContentDTO.add(qaQuestionContentDTO);
} else {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -29,6 +29,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.TreeMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -178,17 +179,14 @@
Iterator queIterator = qaContent.getQaQueContents().iterator();
while (queIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
QaQueContent qaQueContent = (QaQueContent) queIterator.next();
if (qaQueContent != null) {
- qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion());
- qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString());
- qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback());
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(qaQueContent);
listQuestionContentDTO.add(qaQuestionContentDTO);
}
}
-
+
request.setAttribute(LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java
===================================================================
diff -u -r8a0ce21a725377050cc155f9edb0edad71ac2fd4 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java (.../QaPedagogicalPlannerAction.java) (revision 8a0ce21a725377050cc155f9edb0edad71ac2fd4)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaPedagogicalPlannerAction.java (.../QaPedagogicalPlannerAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -116,7 +116,7 @@
} else {
QaQueContent qaQueContent = new QaQueContent();
qaQueContent.setDisplayOrder(questionIndex + 1);
- qaQueContent.setIsOptional(false);
+ qaQueContent.setRequired(false);
qaQueContent.setQaContent(qaContent);
qaQueContent.setQaContentId(qaContent.getQaContentId());
qaQueContent.setQuestion(question);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -125,6 +125,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -189,9 +190,6 @@
QaGeneralAuthoringDTO qaGeneralAuthoringDTO = new QaGeneralAuthoringDTO();
qaGeneralAuthoringDTO.setContentFolderID(contentFolderID);
- Map mapQuestionContent = new TreeMap(new QaComparator());
- QaStarterAction.logger.debug("mapQuestionContent: " + mapQuestionContent);
-
qaAuthoringForm.resetRadioBoxes();
IQaService qaService = null;
@@ -319,7 +317,7 @@
/* fetch default content */
defaultContentIdStr = qaAuthoringForm.getDefaultContentIdStr();
QaStarterAction.logger.debug("defaultContentIdStr:" + defaultContentIdStr);
- qaContent = retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(
+ qaContent = retrieveContent(request, mapping, qaAuthoringForm, new Long(
defaultContentIdStr).longValue(), true, qaService, qaGeneralAuthoringDTO, sessionMap);
QaStarterAction.logger.debug("post retrive content :" + sessionMap);
@@ -336,7 +334,7 @@
QaStarterAction.logger.debug("add error.content.inUse to ActionMessages.");
return mapping.findForward(QaAppConstants.ERROR_LIST);
}
- qaContent = retrieveContent(request, mapping, qaAuthoringForm, mapQuestionContent, new Long(
+ qaContent = retrieveContent(request, mapping, qaAuthoringForm, new Long(
strToolContentID).longValue(), false, qaService, qaGeneralAuthoringDTO, sessionMap);
QaStarterAction.logger.debug("post retrive content :" + sessionMap);
@@ -369,17 +367,9 @@
String destination = QaUtils.getDestination(sourceMcStarter, requestedModule);
QaStarterAction.logger.debug("destination: " + destination);
- Map mapQuestionContentLocal = qaGeneralAuthoringDTO.getMapQuestionContent();
-
-
-
- sessionMap.put(QaAppConstants.MAP_QUESTION_CONTENT_KEY, mapQuestionContent);
-
QaStarterAction.logger.debug("persisting sessionMap into session: " + sessionMap);
request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
-
-
request.setAttribute(QaAppConstants.QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO);
return mapping.findForward(destination);
@@ -389,7 +379,7 @@
* retrives the existing content information from the db and prepares the
* data for presentation purposes. ActionForward
* retrieveExistingContent(HttpServletRequest request, ActionMapping
- * mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long
+ * mapping, QaAuthoringForm qaAuthoringForm, long
* toolContentID)
*
* @param request
@@ -400,7 +390,7 @@
* @return ActionForward
*/
protected QaContent retrieveContent(HttpServletRequest request, ActionMapping mapping,
- QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentID, boolean isDefaultContent,
+ QaAuthoringForm qaAuthoringForm, long toolContentID, boolean isDefaultContent,
IQaService qaService, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, SessionMap sessionMap) {
QaStarterAction.logger.debug("toolContentID: " + toolContentID);
@@ -447,52 +437,38 @@
sessionMap.put(QaAppConstants.ACTIVITY_TITLE_KEY, qaGeneralAuthoringDTO.getActivityTitle());
sessionMap.put(QaAppConstants.ACTIVITY_INSTRUCTIONS_KEY, qaGeneralAuthoringDTO.getActivityInstructions());
- List listQuestionContentDTO = new LinkedList();
+ List listQuestionContentDTO = new LinkedList();
/*
* get the existing question content
*/
- QaStarterAction.logger.debug("setting content data from the db");
- mapQuestionContent.clear();
+ boolean isFirst = false;
Iterator queIterator = qaContent.getQaQueContents().iterator();
- Long mapIndex = new Long(1);
-
while (queIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO();
QaQueContent qaQueContent = (QaQueContent) queIterator.next();
if (qaQueContent != null) {
-
-
-
-
- mapQuestionContent.put(mapIndex.toString(), qaQueContent.getQuestion());
-
- qaQuestionContentDTO.setQuestion(qaQueContent.getQuestion());
- qaQuestionContentDTO.setDisplayOrder(new Integer(qaQueContent.getDisplayOrder()).toString());
- qaQuestionContentDTO.setFeedback(qaQueContent.getFeedback());
+ QaQuestionContentDTO qaQuestionContentDTO = new QaQuestionContentDTO(qaQueContent);
listQuestionContentDTO.add(qaQuestionContentDTO);
/**
* make the first entry the default(first) one for jsp
*/
- if (mapIndex.longValue() == 1) {
+ if (isFirst) {
qaGeneralAuthoringDTO.setDefaultQuestionContent(qaQueContent.getQuestion());
+ isFirst = false;
}
- mapIndex = new Long(mapIndex.longValue() + 1);
}
}
- request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(mapQuestionContent.size()));
-
-
+ request.setAttribute(QaAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size()));
request.setAttribute(QaAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO);
sessionMap.put(QaAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO);
SortedSet conditionSet = new TreeSet(new TextSearchConditionComparator());
for (QaCondition condition : qaContent.getConditions()) {
conditionSet.add(condition);
- for (QaQuestionContentDTO dto : (List) listQuestionContentDTO) {
+ for (QaQuestionContentDTO dto : listQuestionContentDTO) {
for (QaQueContent question : condition.getQuestions()) {
if (dto.getDisplayOrder().equals(String.valueOf(question.getDisplayOrder()))) {
condition.temporaryQuestionDTOSet.add(dto);
@@ -508,11 +484,6 @@
}
-
- qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent);
-
-
-
qaGeneralAuthoringDTO.setOnlineInstructions(qaContent.getOnlineInstructions());
qaGeneralAuthoringDTO.setOfflineInstructions(qaContent.getOfflineInstructions());
Index: lams_tool_laqa/web/authoring/editQuestionBox.jsp
===================================================================
diff -u -r8179037dc958585c054547eb7de9be14c6aed233 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/web/authoring/editQuestionBox.jsp (.../editQuestionBox.jsp) (revision 8179037dc958585c054547eb7de9be14c6aed233)
+++ lams_tool_laqa/web/authoring/editQuestionBox.jsp (.../editQuestionBox.jsp) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -65,6 +65,24 @@
contentFolderID="${qaGeneralAuthoringDTO.contentFolderID}">
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_laqa/web/authoring/newQuestionBox.jsp
===================================================================
diff -u -r8179037dc958585c054547eb7de9be14c6aed233 -r4c9365155a19f048af7f0465ced0b965141292d5
--- lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 8179037dc958585c054547eb7de9be14c6aed233)
+++ lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
@@ -212,4 +212,29 @@