Index: lams_tool_laqa/.classpath
===================================================================
diff -u -r7aeb528c89386d6a2aaef95b4d99d47612c8f734 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/.classpath (.../.classpath) (revision 7aeb528c89386d6a2aaef95b4d99d47612c8f734)
+++ lams_tool_laqa/.classpath (.../.classpath) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -15,5 +15,5 @@
-
+
Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaCondition.hbm.xml
===================================================================
diff -u -r33f9171c071c179459972380a9b732f1aeec87bf -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaCondition.hbm.xml (.../QaCondition.hbm.xml) (revision 33f9171c071c179459972380a9b732f1aeec87bf)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaCondition.hbm.xml (.../QaCondition.hbm.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -30,7 +30,7 @@
Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -190,7 +190,7 @@
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaQueContent.hbm.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml
===================================================================
diff -u -r89b6e076006b36f7edcf712cfa97b87ef9010e23 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml (.../QaQueUsr.hbm.xml) (revision 89b6e076006b36f7edcf712cfa97b87ef9010e23)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml (.../QaQueUsr.hbm.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -55,15 +55,6 @@
access="property"
column="learnerFinished"
/>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaSession.hbm.xml
===================================================================
diff -u -rdba99aacc32e5b7a5bbc7ab302f7a5a488e3c680 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaSession.hbm.xml (.../QaSession.hbm.xml) (revision dba99aacc32e5b7a5bbc7ab302f7a5a488e3c680)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaSession.hbm.xml (.../QaSession.hbm.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -60,17 +60,6 @@
length="100"
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
questions = new TreeSet(new QaQueContentComparator());
+ private Set questions = new TreeSet(new QaQueContentComparator());
private static Logger log = Logger.getLogger(QaCondition.class);
- public SortedSet temporaryQuestionDTOSet = new TreeSet(
+ public SortedSet temporaryQuestionDTOSet = new TreeSet(
new QaQuestionContentDTOComparator());
public QaCondition() {
@@ -63,15 +65,15 @@
public QaCondition(QaConditionDTO conditionDTO) {
super(conditionDTO);
- for (QaQueContent question : conditionDTO.getQuestions()) {
- QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null,
- question.isRequired(), null, null, null);
+ for (QaQuestion question : conditionDTO.getQuestions()) {
+ QaQuestion questionCopy = new QaQuestion(question.getQuestion(), question.getDisplayOrder(), null,
+ question.isRequired(), null, null);
getQuestions().add(questionCopy);
}
}
public QaCondition(Long conditionId, Integer conditionUIID, Integer orderId, String name, String displayName,
- String allWords, String phrase, String anyWords, String excludedWords, Set questions) {
+ String allWords, String phrase, String anyWords, String excludedWords, Set questions) {
super(conditionId, conditionUIID, orderId, name, displayName, BranchCondition.OUTPUT_TYPE_COMPLEX, null, null,
null, allWords, phrase, anyWords, excludedWords);
setQuestions(questions);
@@ -87,7 +89,7 @@
// the condition "knows" it's an array of strings, i.e. user's answers
String[] answers = (String[]) value.getValue();
result = true;
- for (QaQueContent question : questions) {
+ for (QaQuestion question : questions) {
String textToMatch = answers[question.getDisplayOrder() - 1];
textToMatch = WebUtil.removeHTMLtags(textToMatch);
result &= matches(textToMatch);
@@ -104,11 +106,11 @@
return result;
}
- public Set getQuestions() {
+ public Set getQuestions() {
return questions;
}
- public void setQuestions(Set questions) {
+ public void setQuestions(Set questions) {
this.questions = questions;
}
@@ -117,7 +119,7 @@
*/
@Override
public Object clone() {
- Set questionsCopy = new TreeSet(new QaQueContentComparator());
+ Set questionsCopy = new TreeSet(new QaQueContentComparator());
questionsCopy.addAll(questions);
return new QaCondition(null, null, orderId, name, displayName, allWords, phrase, anyWords, excludedWords,
questionsCopy);
@@ -132,11 +134,11 @@
@Override
public QaCondition clone(int uiidOffset) {
Integer newConditionUIID = LearningDesign.addOffset(conditionUIID, uiidOffset);
- Set questionsCopy = new TreeSet(new QaQueContentComparator());
+ Set questionsCopy = new TreeSet(new QaQueContentComparator());
- for (QaQueContent question : getQuestions()) {
- QaQueContent questionCopy = new QaQueContent(question.getQuestion(), question.getDisplayOrder(), null,
- question.isRequired(), null, null, null);
+ for (QaQuestion question : getQuestions()) {
+ QaQuestion questionCopy = new QaQuestion(question.getQuestion(), question.getDisplayOrder(), null,
+ question.isRequired(), null, null);
questionsCopy.add(questionCopy);
}
return new QaCondition(null, newConditionUIID, orderId, name, displayName, allWords, phrase, anyWords,
@@ -150,9 +152,9 @@
*/
public QaCondition clone(QaContent qaContent) {
- Set questionsCopy = new TreeSet(new QaQueContentComparator());
- for (QaQueContent conditionQuestion : getQuestions()) {
- for (QaQueContent contentQuestion : (Set) qaContent.getQaQueContents()) {
+ Set questionsCopy = new TreeSet(new QaQueContentComparator());
+ for (QaQuestion conditionQuestion : getQuestions()) {
+ for (QaQuestion contentQuestion : (Set) qaContent.getQaQuestions()) {
if (conditionQuestion.getDisplayOrder() == contentQuestion.getDisplayOrder()) {
questionsCopy.add(contentQuestion);
}
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaConditionDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java (.../QaContent.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaContent.java (.../QaContent.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -124,7 +124,7 @@
private Date updateDate;
/** persistent field */
- private Set qaQueContents;
+ private Set qaQuestions;
/** persistent field */
private Set qaSessions;
@@ -166,7 +166,7 @@
this.reflectionSubject = reflectionSubject;
this.creationDate = creationDate;
this.updateDate = updateDate;
- this.qaQueContents = qaQueContents;
+ this.qaQuestions = qaQueContents;
this.qaSessions = qaSessions;
this.qaUploadedFiles = qaUploadedFiles;
this.conditions = conditions;
@@ -195,7 +195,7 @@
qa.getReflectionSubject(), qa.getCreationDate(), qa.getUpdateDate(), new TreeSet(), new TreeSet(),
new TreeSet(), new TreeSet(new TextSearchConditionComparator()), qa.isAllowRichEditor());
- newContent.setQaQueContents(qa.deepCopyQaQueContent(newContent));
+ newContent.setQaQuestions(qa.deepCopyQaQueContent(newContent));
newContent.setQaUploadedFiles(qa.deepCopyQaAttachments(toolContentHandler, newContent));
newContent.setConditions(qa.deepCopyConditions(newContent));
@@ -204,9 +204,9 @@
public Set deepCopyQaQueContent(QaContent newQaContent) {
Set newQaQueContent = new TreeSet();
- for (Iterator i = this.getQaQueContents().iterator(); i.hasNext();) {
- QaQueContent queContent = (QaQueContent) i.next();
- newQaQueContent.add(QaQueContent.newInstance(queContent, newQaContent));
+ for (Iterator i = this.getQaQuestions().iterator(); i.hasNext();) {
+ QaQuestion queContent = (QaQuestion) i.next();
+ newQaQueContent.add(QaQuestion.newInstance(queContent, newQaContent));
}
return newQaQueContent;
}
@@ -241,15 +241,15 @@
return new TreeSet();
}
- public Set getQaQueContents() {
- if (qaQueContents == null) {
- setQaQueContents(new TreeSet());
+ public Set getQaQuestions() {
+ if (qaQuestions == null) {
+ setQaQuestions(new TreeSet());
}
- return qaQueContents;
+ return qaQuestions;
}
- public void setQaQueContents(Set qaQueContents) {
- this.qaQueContents = qaQueContents;
+ public void setQaQuestions(Set qaQueContents) {
+ this.qaQuestions = qaQueContents;
}
public Set getQaSessions() {
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredAnswersDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaMonitoredUserDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java (.../QaQueUsr.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.java (.../QaQueUsr.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,10 +24,6 @@
package org.lamsfoundation.lams.tool.qa;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -40,20 +36,15 @@
*
* @author Ozgur Demirtas
*
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
- */
-
-/**
- *
- * QaQueUsr Value Object The value object that maps to our model database table:
+ * The value object that maps to our model database table:
* tl_laqa11_que_usr The relevant hibernate mapping resides in: QaQueUsr.hbm.xml
*
* Represents tool users.
*/
-public class QaQueUsr implements Serializable, Comparable, Nullable {
- static Logger logger = Logger.getLogger(QaQueUsr.class.getName());
+public class QaQueUsr implements Serializable, Nullable {
+ private static final long serialVersionUID = -6768077344827699440L;
+
/** identifier field */
private Long uid;
@@ -74,57 +65,23 @@
private QaSession qaSession;
/** persistent field */
- private Long qaSessionId;
-
- /** persistent field */
- private QaQueContent qaQueContent;
-
- /** persistent field */
private Set qaUsrResps;
public QaQueUsr() {
};
/** full constructor */
- public QaQueUsr(Long queUsrId, String username, String fullname, QaQueContent qaQueContent, QaSession qaSession,
+ public QaQueUsr(Long queUsrId, String username, String fullname, QaSession qaSession,
Set qaUsrResps)
{
this.queUsrId = queUsrId;
this.username = username;
this.fullname = fullname;
- this.qaQueContent = qaQueContent;
this.qaSession = qaSession;
this.qaUsrResps = qaUsrResps;
}
- /** minimal constructor */
- public QaQueUsr(QaQueContent qaQueContent, QaSession qaSession, Set qaUsrResps)
-
- {
- this.qaQueContent = qaQueContent;
- this.qaSession = qaSession;
- this.qaUsrResps = qaUsrResps;
- }
-
- public QaQueUsr(Long queUsrId, String username, String fullname, QaQueContent qaQueContent, QaSession qaSession) {
- this.queUsrId = queUsrId;
- this.username = username;
- this.fullname = fullname;
- this.qaQueContent = qaQueContent;
- this.qaSession = qaSession;
- }
-
- public QaQueUsr(String username, String fullname, QaQueContent qaQueContent, QaSession qaSession, Set qaUsrResps)
-
- {
- this.username = username;
- this.fullname = fullname;
- this.qaQueContent = qaQueContent;
- this.qaSession = qaSession;
- this.qaUsrResps = qaUsrResps;
- }
-
/**
* Copy construtor; We copy all data except the hibernate id field.
*
@@ -133,8 +90,8 @@
* @return the survey question user object.
*/
public QaQueUsr newInstance(QaQueUsr queUsr) {
- return new QaQueUsr(queUsr.getQueUsrId(), queUsr.getUsername(), queUsr.getFullname(), queUsr.getQaQueContent(),
- queUsr.getQaSession(), queUsr.getQaUsrResps());
+ return new QaQueUsr(queUsr.getQueUsrId(), queUsr.getUsername(), queUsr.getFullname(), queUsr.getQaSession(),
+ queUsr.getQaUsrResps());
}
/**
@@ -153,21 +110,6 @@
}
/**
- * @return Returns the qaQueContent.
- */
- public QaQueContent getQaQueContent() {
- return qaQueContent;
- }
-
- /**
- * @param qaQueContent
- * The qaQueContent to set.
- */
- public void setQaQueContent(QaQueContent qaQueContent) {
- this.qaQueContent = qaQueContent;
- }
-
- /**
* @return Returns the qaSession.
*/
public QaSession getQaSession() {
@@ -238,192 +180,18 @@
if (!(other instanceof QaQueUsr))
return false;
QaQueUsr castOther = (QaQueUsr) other;
- return new EqualsBuilder().append(this.getQueUsrId(), castOther.getQueUsrId())
- //.append(this.getUserId(),castOther.getUserId())
- //.append(this.getQaQueContent(),castOther.getQaQueContent())
- .isEquals();
+ return new EqualsBuilder().append(this.getQueUsrId(), castOther.getQueUsrId()).isEquals();
}
public int hashCode() {
- return new HashCodeBuilder().append(getQueUsrId())
- //.append(getUserId())
- .toHashCode();
+ return new HashCodeBuilder().append(getQueUsrId()).toHashCode();
}
- //---------------------------------------------------------------------
- // Convenient Service Methods
- //---------------------------------------------------------------------
- /**
- * Check up question responsed by current user against a list user
- * responses. Return true if
- *
- * @param responses
- * @return the validation result
- */
- public boolean checkUpQueUsrHas(List responses) {
- if (responses == null)
- throw new IllegalArgumentException("Invalid responses from " + this.getFullname()
- + ": Can't validate null responses" + "against current survey questions");
-
- //make defensive copy to avoid list mutation outside this class.
- ArrayList resps = new ArrayList(responses);
-
- for (Iterator i = resps.iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if (doesQueUserHas(resp))
- return true;
- }
- return false;
- }
-
- /**
- * The helper function to validate the availability of a user response for
- * this question user. The condition to return true is:
- *
the requested response has a reference to a question user object and
- * reference id is the same as current question user object.
- *
- * @param response
- * the user response
- * @return the validation result
- */
- public boolean doesQueUserHas(QaUsrResp response) {
- if (response.getQaQueUser() == null)
- throw new IllegalArgumentException("Invalid response :" + " Can't validate the availability"
- + " of a response without the reference to a user");
-
- if (response.getQaQueUser().getQueUsrId() == null || this.getQueUsrId() == null)
- return false;
-
- if (this.getQueUsrId().equals(response.getQaQueUser().getQueUsrId()))
- return true;
- return false;
- }
-
- /**
- * @param responses
- * @param responseSet
- */
- public void removeResponseBy(ArrayList responses) {
- Set responseSet = new TreeSet(this.getQaUsrResps());
- //remove responses no longer exist.
- for (Iterator i = responseSet.iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if (!resp.doesRespExistIn(responses))
- this.getQaUsrResps().remove(resp);
- }
- }
-
- /**
- * Update the user responses of this question user object against a list of
- * new user responses.
- *
- * @param responses
- */
- public void updateQueUsr(List responses) {
- if (responses == null)
- throw new IllegalArgumentException("Invalid responses from " + this.getFullname()
- + ": Can't update null responses" + "against current survey questions");
-
- //make defensive copy to avoid list mutation outside this class.
- ArrayList resps = new ArrayList(responses);
- //clean up all the existing reponses
- removeResponseBy(resps);
- addNewResponsesBy(resps);
- updateExistingResp(resps);
- }
-
- /**
- * @param resps
- * @param responseList
- */
- public void addNewResponsesBy(ArrayList resps) {
- ArrayList responseList = new ArrayList(this.getQaUsrResps());
- //add all associated new responses into the current question user.
- for (Iterator i = resps.iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if (!resp.doesRespExistIn(responseList) && doesQueUserHas(resp))
- addUserResponse(resp);
- }
- }
-
- /**
- * @param responses
- * @param responseSet
- */
- public void updateExistingResp(ArrayList responses) {
- //update existing responses
- for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if (resp.doesRespExistIn(responses))
- resp.updateResponseBy(responses);
- }
- }
-
- /**
- * @param resp
- */
- public void addUserResponse(QaUsrResp resp) {
- if (resp != null && !resp.isResponseValid())
- throw new IllegalArgumentException("Invalid response for update ");
-
- this.getQaUsrResps().add(resp);
- }
-
- /**
- * Get a list of user response Strings that are correspondent to the
- * authored defined candidate answers. Currently, we include the free text
- * answer to this category as well.
- *
- * @return the list of String user responses
- */
- public List getPredefinedResponse() {
- LinkedList responses = new LinkedList();
-
- for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) {
- QaUsrResp res = (QaUsrResp) i.next();
- if (res.isPredefinedResponse()) {
- responses.add(res.getAnswer());
- }
- }
- return responses;
- }
-
- public String getOtherResponse() {
- for (Iterator i = this.getQaUsrResps().iterator(); i.hasNext();) {
- QaUsrResp res = (QaUsrResp) i.next();
- if (!res.isPredefinedResponse())
- return res.getAnswer();
- }
-
- return "";
- }
-
- public int compareTo(Object o) {
-
- QaQueUsr qUser = (QaQueUsr) o;
- return this.getQaQueContent().compareTo(qUser.getQaQueContent());
- }
-
public boolean isNull() {
return false;
}
/**
- * @return Returns the qaSessionId.
- */
- public Long getQaSessionId() {
- return qaSessionId;
- }
-
- /**
- * @param qaSessionId
- * The qaSessionId to set.
- */
- public void setQaSessionId(Long qaSessionId) {
- this.qaSessionId = qaSessionId;
- }
-
- /**
* @return Returns the uid.
*/
public Long getUid() {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestion.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestion.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestion.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,228 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * @author Ozgur Demirtas
+ *
+ * The value object that maps to our model database table: tl_laqa11_que_content The relevant hibernate mapping
+ * resides in: QaQuestion.hbm.xml
+ *
+ * Holds question content within a particular content
+ */
+public class QaQuestion implements Serializable, Comparable, Nullable {
+
+ private static final long serialVersionUID = -4028785701106936621L;
+
+ /** identifier field */
+ private Long uid;
+
+ /** nullable persistent field */
+ private String question;
+
+ /** nullable persistent field */
+ private int displayOrder;
+
+ private String feedback;
+
+ private boolean required;
+
+ /** nullable persistent field */
+ private QaContent qaContent;
+
+ /** persistent field */
+ private Set qaQueUsers;
+
+ /** default constructor */
+ public QaQuestion() {
+ }
+
+ public QaQuestion(String question, int displayOrder, String feedback, boolean required,
+ QaContent qaContent, Set qaQueUsers) {
+ this.question = question;
+ this.displayOrder = displayOrder;
+ this.feedback = feedback;
+ this.required = required;
+ this.qaContent = qaContent;
+ this.qaQueUsers = qaQueUsers;
+ }
+
+ public static QaQuestion newInstance(QaQuestion queContent, QaContent newQaContent) {
+ QaQuestion newQueContent = new QaQuestion(queContent.getQuestion(), queContent.getDisplayOrder(),
+ queContent.getFeedback(), queContent.isRequired(), newQaContent, new TreeSet());
+ return newQueContent;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("qaQueContentId: ", getUid()).append("question: ", getQuestion())
+ .append("displayOrder: ", getDisplayOrder()).toString();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof QaQuestion)) {
+ return false;
+ }
+ QaQuestion castOther = (QaQuestion) other;
+ return new EqualsBuilder().append(this.getUid(), castOther.getUid()).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(getUid()).toHashCode();
+ }
+
+ /**
+ * @return Returns the displayOrder.
+ */
+ public int getDisplayOrder() {
+ return displayOrder;
+ }
+
+ /**
+ * @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.
+ */
+ public org.lamsfoundation.lams.tool.qa.QaContent getQaContent() {
+ return qaContent;
+ }
+
+ /**
+ * @param qaContent
+ * The qaContent to set.
+ */
+ public void setQaContent(org.lamsfoundation.lams.tool.qa.QaContent qaContent) {
+ this.qaContent = qaContent;
+ }
+
+ /**
+ * @return Returns the qaQueUsers.
+ */
+ public Set getQaQueUsers() {
+ if (qaQueUsers == null) {
+ setQaQueUsers(new TreeSet());
+ }
+ return qaQueUsers;
+ }
+
+ /**
+ * @param qaQueUsers
+ * The qaQueUsers to set.
+ */
+ public void setQaQueUsers(Set qaQueUsers) {
+ this.qaQueUsers = qaQueUsers;
+ }
+
+ /**
+ * @return Returns the question.
+ */
+ public String getQuestion() {
+ return question;
+ }
+
+ /**
+ * @param question
+ * The question to set.
+ */
+ public void setQuestion(String question) {
+ this.question = question;
+ }
+
+ public boolean isNull() {
+ return false;
+ }
+
+ public int compareTo(Object o) {
+ //QaQuestion queContent = (QaQuestion) o;
+
+ // if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference.
+ /*
+ * if (uid == null) return 1; else return (int) (uid.longValue() - queContent.uid.longValue());
+ */
+ return 1;
+ }
+
+ /**
+ * @return Returns the uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ /**
+ * @param uid
+ * The uid to set.
+ */
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @return Returns the feedback.
+ */
+ public String getFeedback() {
+ return feedback;
+ }
+
+ /**
+ * @param feedback
+ * The feedback to set.
+ */
+ public void setFeedback(String feedback) {
+ this.feedback = feedback;
+ }
+}
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQuestionContentDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java (.../QaSession.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java (.../QaSession.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -75,9 +75,6 @@
/** persistent field */
private Set qaQueUsers;
- /** persistent field */
- private Long qaContentId;
-
public QaSession() {
};
@@ -185,14 +182,6 @@
return false;
}
- public Long getQaContentId() {
- return qaContentId;
- }
-
- public void setQaContentId(Long qaContentId) {
- this.qaContentId = qaContentId;
- }
-
public Long getUid() {
return uid;
}
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStatsDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaStringComparator.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java (.../QaUploadedFile.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUploadedFile.java (.../QaUploadedFile.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -31,7 +31,6 @@
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,9 +43,9 @@
*/
/**
- * QaQueContent Value Object The value object that maps to our model database
+ * QaQuestion Value Object The value object that maps to our model database
* table: tl_laqa11_que_content The relevant hibernate mapping resides in:
- * QaQueContent.hbm.xml
+ * QaQuestion.hbm.xml
*
* Holds question content within a particular content
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java (.../QaUsrResp.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUsrResp.java (.../QaUsrResp.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -25,8 +25,6 @@
import java.io.Serializable;
import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
@@ -52,77 +50,49 @@
private String answer;
/** nullable persistent field */
- private boolean hidden;
-
- /** nullable persistent field */
private Date attemptTime;
/** nullable persistent field */
- private QaQueContent qaQueContent;
+ private QaQuestion qaQuestion;
private boolean visible;
/** nullable persistent field */
- private Long qaQueContentId; //added to enable deletion by the resp dao
-
- /** nullable persistent field */
- private Long queUsrId; //added to enable deletion by the resp dao
-
- /** nullable persistent field */
private QaQueUsr qaQueUser;
/** nullable persistent field */
private String timezone;
/** full constructor */
- public QaUsrResp(Long responseId, String answer, boolean hidden, Date attemptTime, String timezone,
- QaQueContent qaQueContent, QaQueUsr qaQueUser) {
+ public QaUsrResp(Long responseId, String answer, Date attemptTime, String timezone,
+ QaQuestion qaQuestion, QaQueUsr qaQueUser) {
this.responseId = responseId;
this.answer = answer;
- this.hidden = hidden;
this.attemptTime = attemptTime;
this.timezone = timezone;
- this.qaQueContent = qaQueContent;
+ this.qaQuestion = qaQuestion;
this.qaQueUser = qaQueUser;
}
- public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent,
+ public QaUsrResp(String answer, Date attemptTime, String timezone, QaQuestion qaQuestion,
QaQueUsr qaQueUser) {
this.answer = answer;
- this.hidden = hidden;
this.attemptTime = attemptTime;
this.timezone = timezone;
- this.qaQueContent = qaQueContent;
+ this.qaQuestion = qaQuestion;
this.qaQueUser = qaQueUser;
}
- public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent,
+ public QaUsrResp(String answer, Date attemptTime, String timezone, QaQuestion qaQuestion,
QaQueUsr qaQueUser, boolean visible) {
this.answer = answer;
- this.hidden = hidden;
this.attemptTime = attemptTime;
this.timezone = timezone;
- this.qaQueContent = qaQueContent;
+ this.qaQuestion = qaQuestion;
this.qaQueUser = qaQueUser;
this.visible = visible;
}
- public QaUsrResp(String answer, boolean hidden, Date attemptTime, String timezone, QaQueContent qaQueContent,
- Long qaQueUsrUid) {
- this.answer = answer;
- this.hidden = hidden;
- this.attemptTime = attemptTime;
- this.timezone = timezone;
- this.qaQueContent = qaQueContent;
- this.queUsrId = qaQueUsrUid;
- }
-
- public QaUsrResp(String answer, Date attemptTime, QaQueContent question) {
- this.answer = answer;
- this.attemptTime = attemptTime;
- this.qaQueContent = question;
- }
-
/** default constructor */
public QaUsrResp() {
}
@@ -136,8 +106,8 @@
* @return the new qa user response cloned from original object
*/
public static QaUsrResp newInstance(QaUsrResp response) {
- return new QaUsrResp(response.getResponseId(), response.getAnswer(), response.isHidden(), response
- .getAttemptTime(), response.getTimezone(), response.getQaQueContent(), response.qaQueUser);
+ return new QaUsrResp(response.getResponseId(), response.getAnswer(), response
+ .getAttemptTime(), response.getTimezone(), response.getQaQuestion(), response.qaQueUser);
}
public String toString() {
@@ -187,18 +157,18 @@
}
/**
- * @return Returns the qaQueContent.
+ * @return Returns the qaQuestion.
*/
- public QaQueContent getQaQueContent() {
- return qaQueContent;
+ public QaQuestion getQaQuestion() {
+ return qaQuestion;
}
/**
- * @param qaQueContent
- * The qaQueContent to set.
+ * @param qaQuestion
+ * The qaQuestion to set.
*/
- public void setQaQueContent(QaQueContent qaQueContent) {
- this.qaQueContent = qaQueContent;
+ public void setQaQuestion(QaQuestion qaQuestion) {
+ this.qaQuestion = qaQuestion;
}
/**
@@ -231,74 +201,6 @@
this.responseId = responseId;
}
- /**
- * @param responses
- * @return
- */
- public boolean doesRespExistIn(List responses) {
- for (Iterator i = responses.iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if ((resp.getAnswer().trim()).equals(this.getAnswer().trim())
- && resp.getQaQueUser().getQueUsrId() == this.getQaQueUser().getQueUsrId())
- return true;
- }
- return false;
- }
-
- /**
- * @param responses
- */
- public void updateResponseBy(List responses) {
- for (Iterator i = responses.iterator(); i.hasNext();) {
- QaUsrResp resp = (QaUsrResp) i.next();
- if (resp.getQaQueUser().getQueUsrId() == this.getQaQueUser().getQueUsrId())
- // && resp.getQaAnsContent().getDisplayOrder()==this.getQaAnsContent().getDisplayOrder())
- this.updateResponse(resp);
-
- }
- }
-
- /**
- * The response is not valid if it doesn't have a reference to question
- * object and question user object.
- *
- * @param resp
- * the response to be validated
- * @return the validation result.
- */
- public boolean isResponseValid() {
- return this.getQaQueUser() != null && this.getQaQueContent() != null;
- // &&this.getQaAnsContent()!=null;
- }
-
- /**
- * Update current object according to the new response object.
- *
- * @param resp
- */
- public void updateResponse(QaUsrResp resp) {
- if (!resp.isResponseValid())
- throw new IllegalArgumentException("Invalid response for update ");
-
- this.setAnswer(resp.getAnswer());
- this.setAttemptTime(resp.getAttemptTime());
- this.setQaQueContent(resp.getQaQueContent());
-
- this.setQaQueUser(resp.getQaQueUser());
-
- }
-
- /**
- * Validate whether the current response is correspondent to an author
- * defined answer.
- *
- * @return boolean value
- */
- public boolean isPredefinedResponse() {
- //may need to add more logic here
- return false;
- }
-
public int compareTo(Object o) {
QaUsrResp response = (QaUsrResp) o;
@@ -311,51 +213,6 @@
}
/**
- * @return Returns the qaQueContentId.
- */
- public Long getQaQueContentId() {
- return qaQueContentId;
- }
-
- /**
- * @param qaQueContentId
- * The qaQueContentId to set.
- */
- public void setQaQueContentId(Long qaQueContentId) {
- this.qaQueContentId = qaQueContentId;
- }
-
- /**
- * @return Returns the queUsrId.
- */
- public Long getQueUsrId() {
- return queUsrId;
- }
-
- /**
- * @param queUsrId
- * The queUsrId to set.
- */
- public void setQueUsrId(Long queUsrId) {
- this.queUsrId = queUsrId;
- }
-
- /**
- * @return Returns the hidden.
- */
- public boolean isHidden() {
- return hidden;
- }
-
- /**
- * @param hidden
- * The hidden to set.
- */
- public void setHidden(boolean hidden) {
- this.hidden = hidden;
- }
-
- /**
* @return Returns the timezone.
*/
public String getTimezone() {
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java (.../QaWizardCategory.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardCategory.java (.../QaWizardCategory.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,8 +24,6 @@
package org.lamsfoundation.lams.tool.qa;
import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java (.../QaWizardQuestion.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaWizardQuestion.java (.../QaWizardQuestion.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,8 +24,6 @@
package org.lamsfoundation.lams.tool.qa;
import java.io.Serializable;
-import java.util.Set;
-import java.util.TreeSet;
import org.apache.log4j.Logger;
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/ReflectionDTO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java
===================================================================
diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java (.../IQaContentDAO.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaContentDAO.java (.../IQaContentDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -32,12 +32,8 @@
*
*/
public interface IQaContentDAO {
- public QaContent getQaById(long qaId);
+ public QaContent getQaByContentId(long qaId);
- public QaContent loadQaById(long qaId);
-
- public QaContent getQaContentByUID(Long uid);
-
public QaContent getQaBySession(Long sessionId);
public void saveOrUpdateQa(QaContent qa);
@@ -54,8 +50,6 @@
public void removeAllQaSession(QaContent content);
- public int countUserResponsed(QaContent content);
-
public void deleteCondition(QaCondition condition);
public void removeQuestionsFromCache(QaContent qaContent);
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueContentDAO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java
===================================================================
diff -u -rf7b64c7ef2c9cd9db07f7d9c5569a1a663b3fc39 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java (.../IQaQueUsrDAO.java) (revision f7b64c7ef2c9cd9db07f7d9c5569a1a663b3fc39)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQueUsrDAO.java (.../IQaQueUsrDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -35,7 +35,6 @@
*
*/
public interface IQaQueUsrDAO {
- public QaQueUsr getQaUserByUID(Long uid);
public QaQueUsr getQaQueUsrById(long qaQueUsrId);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQuestionDAO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQuestionDAO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaQuestionDAO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,53 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dao;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
+
+/**
+ *
+ * @author Ozgur Demirtas
+ *
+ */
+public interface IQaQuestionDAO {
+
+ public void createQueContent(QaQuestion queContent);
+
+ public void saveOrUpdateQaQueContent(QaQuestion qaQuestion);
+
+ public void removeQueContent(long qaQueContentId);
+
+ public void removeQaQueContent(QaQuestion qaQuestion);
+
+ public List getAllQuestionEntries(final long qaContentId);
+
+ public QaQuestion getQuestionContentByQuestionText(final String question, Long qaContentId);
+
+ public QaQuestion getQuestionByDisplayOrder(Long displayOrder, Long qaContentId);
+
+ public List getAllQuestionEntriesSorted(final long qaContentId);
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java
===================================================================
diff -u -r7b3e1eb125d38e4df23c247e25c27061adbaa269 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java (.../IQaSessionDAO.java) (revision 7b3e1eb125d38e4df23c247e25c27061adbaa269)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaSessionDAO.java (.../IQaSessionDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -34,20 +34,11 @@
*
*/
public interface IQaSessionDAO {
- public int countSessionIncomplete();
- public int countSessionComplete();
-
public int countSessionComplete(QaContent qa);
public QaSession getQaSessionById(long qaSessionId);
- public List getToolSessionsForContent(QaContent qa);
-
- public QaSession getQaSessionOrNullById(long qaSessionId);
-
- public int studentActivityOccurred(QaContent qa);
-
public void CreateQaSession(QaSession session);
public void UpdateQaSession(QaSession session);
@@ -56,7 +47,5 @@
public List getSessionsFromContent(QaContent qaContent);
- public String getSessionNameById(long qaSessionId);
-
public List getSessionNamesFromContent(QaContent qaContent);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java
===================================================================
diff -u -r7b3e1eb125d38e4df23c247e25c27061adbaa269 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java (.../IQaUsrRespDAO.java) (revision 7b3e1eb125d38e4df23c247e25c27061adbaa269)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/IQaUsrRespDAO.java (.../IQaUsrRespDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -23,8 +23,6 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa.dao;
-import java.util.List;
-
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
/**
@@ -33,21 +31,16 @@
*
*/
public interface IQaUsrRespDAO {
- public void saveUserResponse(QaUsrResp resp);
- public QaUsrResp getAttemptByUID(Long uid);
-
public void updateUserResponse(QaUsrResp resp);
public void createUserResponse(QaUsrResp resp);
public void removeUserResponse(QaUsrResp resp);
- public void removeUserResponseByQaQueId(Long qaQueId);
+ public QaUsrResp getResponseById(Long responseId);
- public QaUsrResp retrieveQaUsrResp(long responseId);
-
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId);
-
- public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId);
+ public QaUsrResp getResponseByUserAndQuestion(final Long queUsrId, final Long questionId);
+
+ int getCountResponsesByQaContent(final Long qaContentId);
}
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/QaQueUsrDAO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaConfigItemDAO.java
===================================================================
diff -u -r80a367726b9e7607851be28429bda54d9b306159 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaConfigItemDAO.java (.../QaConfigItemDAO.java) (revision 80a367726b9e7607851be28429bda54d9b306159)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaConfigItemDAO.java (.../QaConfigItemDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -26,8 +26,8 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.lamsfoundation.lams.dao.hibernate.BaseDAO;
-import org.lamsfoundation.lams.tool.qa.dao.IQaConfigItemDAO;
import org.lamsfoundation.lams.tool.qa.QaConfigItem;
+import org.lamsfoundation.lams.tool.qa.dao.IQaConfigItemDAO;
import org.springframework.orm.hibernate3.HibernateCallback;
public class QaConfigItemDAO extends BaseDAO implements IQaConfigItemDAO {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -32,7 +32,7 @@
import org.hibernate.Session;
import org.lamsfoundation.lams.tool.qa.QaCondition;
import org.lamsfoundation.lams.tool.qa.QaContent;
-import org.lamsfoundation.lams.tool.qa.QaQueContent;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
import org.lamsfoundation.lams.tool.qa.dao.IQaContentDAO;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
@@ -41,8 +41,6 @@
/**
* @author Ozgur Demirtas
*
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
*/
public class QaContentDAO extends HibernateDaoSupport implements IQaContentDAO {
@@ -51,17 +49,7 @@
private static final String LOAD_QA_BY_SESSION = "select qa from QaContent qa left join fetch "
+ "qa.qaSessions session where session.qaSessionId=:sessionId";
- private static final String COUNT_USER_RESPONSED = "select distinct u.userId from QaQueUsr u left join fetch"
- + " u.qaQueContent as ques where ques.qaContent = :qa group by u.userId";
-
- public QaContentDAO() {
- }
-
- public QaContent getQaById(long qaId) {
- return loadQaById(qaId);
- }
-
- public QaContent loadQaById(long qaId) {
+ public QaContent getQaByContentId(long qaId) {
String query = "from QaContent as qa where qa.qaContentId = ?";
HibernateTemplate templ = this.getHibernateTemplate();
List list = getSession().createQuery(query).setLong(0, qaId).list();
@@ -73,10 +61,6 @@
return null;
}
- public QaContent getQaContentByUID(Long uid) {
- return (QaContent) this.getHibernateTemplate().get(QaContent.class, uid);
- }
-
public void updateQa(QaContent qa) {
this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(qa);
@@ -112,10 +96,6 @@
this.getHibernateTemplate().update(qa);
}
- public int countUserResponsed(QaContent qa) {
- return getHibernateTemplate().findByNamedParam(QaContentDAO.COUNT_USER_RESPONSED, "qa", qa).size();
- }
-
public void removeAllQaSession(QaContent qaContent) {
this.getHibernateTemplate().deleteAll(qaContent.getQaSessions());
}
@@ -153,7 +133,7 @@
public void removeQuestionsFromCache(QaContent qaContent) {
if (qaContent != null) {
- for (QaQueContent question : (Set) qaContent.getQaQueContents()) {
+ for (QaQuestion question : (Set) qaContent.getQaQuestions()) {
getHibernateTemplate().evict(question);
}
getHibernateTemplate().evict(qaContent);
Fisheye: Tag 91f0740e75daa643981b757e49d1ed2ed7f0a528 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java
===================================================================
diff -u -racc8d2acf5b6b0002e0c8129947040a779ab4077 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -38,28 +38,19 @@
/**
* @author Ozgur Demirtas
*
- * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
- * Templates
*/
public class QaQueUsrDAO extends HibernateDaoSupport implements IQaQueUsrDAO {
static Logger logger = Logger.getLogger(QaQueUsrDAO.class.getName());
- private static final String COUNT_SESSION_USER = "select qaQueUsr.queUsrId from QaQueUsr qaQueUsr where qaQueUsr.qaSessionId= :qaSession";
- private static final String LOAD_USER_FOR_SESSION = "from qaQueUsr in class QaQueUsr where qaQueUsr.qaSessionId= :qaSessionId";
+ private static final String COUNT_SESSION_USER = "select qaQueUsr.queUsrId from QaQueUsr qaQueUsr where qaQueUsr.qaSession.qaSessionId= :qaSession";
+ private static final String LOAD_USER_FOR_SESSION = "from qaQueUsr in class QaQueUsr where qaQueUsr.qaSession.qaSessionId= :qaSessionId";
- private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQueContent qcon where "
+ private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQuestion qcon where "
+ "quser.qaSession=qses and " + "qses.qaContent=qcon and " + "qcon.uid=:uid";
- // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and
- // qses.qa_content_id=5378;
-
- public QaQueUsr getQaUserByUID(Long uid) {
- return (QaQueUsr) this.getHibernateTemplate().get(QaQueUsr.class, uid);
- }
-
public int countSessionUser(QaSession qaSession) {
- return getHibernateTemplate().findByNamedParam(QaQueUsrDAO.COUNT_SESSION_USER, "qaSession", qaSession).size();
+ return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, "qaSession", qaSession)).size();
}
public QaQueUsr getQaQueUsrById(long qaQueUsrId) {
@@ -77,7 +68,7 @@
public QaQueUsr getQaUserBySession(final Long queUsrId, final Long qaSessionId) {
- String strGetUser = "from qaQueUsr in class QaQueUsr where qaQueUsr.queUsrId=:queUsrId and qaQueUsr.qaSessionId=:qaSessionId";
+ String strGetUser = "from qaQueUsr in class QaQueUsr where qaQueUsr.queUsrId=:queUsrId and qaQueUsr.qaSession.qaSessionId=:qaSessionId";
HibernateTemplate templ = this.getHibernateTemplate();
List list = getSession().createQuery(strGetUser).setLong("queUsrId", queUsrId.longValue()).setLong(
"qaSessionId", qaSessionId.longValue()).list();
@@ -91,8 +82,8 @@
public List getUserBySessionOnly(final QaSession qaSession) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(QaQueUsrDAO.LOAD_USER_FOR_SESSION).setLong("qaSessionId",
- qaSession.getUid().longValue()).list();
+ List list = getSession().createQuery(LOAD_USER_FOR_SESSION).setLong("qaSessionId",
+ qaSession.getQaSessionId().longValue()).list();
return list;
}
@@ -119,14 +110,13 @@
int returnInt = 0;
if (qa != null && qa.getUid() != null) {
- List result = getSession().createQuery(QaQueUsrDAO.GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid())
- .list();
- Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0);
+ List result = getSession().createQuery(GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()).list();
+ Long resultLong = (result.get(0) != null) ? (Long) result.get(0) : new Long(0);
returnInt = resultLong.intValue();
} else {
- QaQueUsrDAO.logger.error("Attempt to count users from null content");
+ logger.error("Attempt to count users from null content");
}
- return returnInt;
+ return returnInt;
}
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQuestionDAO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQuestionDAO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQuestionDAO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,108 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dao.hibernate;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.FlushMode;
+import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
+import org.lamsfoundation.lams.tool.qa.dao.IQaQuestionDAO;
+import org.springframework.orm.hibernate3.HibernateTemplate;
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
+/**
+ * @author Ozgur Demirtas
+ *
+ */
+public class QaQuestionDAO extends HibernateDaoSupport implements IQaQuestionDAO {
+ private static final String LOAD_QUESTION_BY_CONTENT_UID = "from qaQuestion in class QaQuestion where qaQuestion.qaContent.uid=:uid";
+ private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from qaQuestion in class QaQuestion where qaQuestion.question=:question and qaQuestion.qaContent.uid=:uid";
+ private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQuestion in class QaQuestion where qaQuestion.displayOrder=:displayOrder and qaQuestion.qaContent.uid=:uid";
+ private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from qaQuestion in class QaQuestion where qaQuestion.qaContent.uid=:uid order by qaQuestion.displayOrder";
+
+ public QaQuestion getQuestionContentByQuestionText(final String question, Long contentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+
+ List list = getSession().createQuery(QaQuestionDAO.LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT).setString(
+ "question", question).setLong("uid", contentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ QaQuestion qa = (QaQuestion) list.get(0);
+ return qa;
+ }
+ return null;
+ }
+
+ public QaQuestion getQuestionByDisplayOrder(Long displayOrder, Long contentUid) {
+ List list = getSession().createQuery(QaQuestionDAO.LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER).setLong(
+ "displayOrder", displayOrder.longValue()).setLong("uid", contentUid.longValue()).list();
+
+ if (list != null && list.size() > 0) {
+ QaQuestion qa = (QaQuestion) list.get(0);
+ return qa;
+ }
+ return null;
+ }
+
+ public List getAllQuestionEntriesSorted(final long contentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQuestionDAO.SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER).setLong(
+ "uid", contentUid).list();
+
+ return list;
+ }
+
+ public List getAllQuestionEntries(final long contentUid) {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(QaQuestionDAO.LOAD_QUESTION_BY_CONTENT_UID).setLong(
+ "uid", contentUid).list();
+
+ return list;
+ }
+
+ public void createQueContent(QaQuestion queContent) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().save(queContent);
+ }
+
+ public void saveOrUpdateQaQueContent(QaQuestion qaQuestion) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().saveOrUpdate(qaQuestion);
+ }
+
+ public void removeQueContent(long qaQueContentId) {
+ QaQuestion qaQuestion = (QaQuestion) this.getHibernateTemplate().load(QaQuestion.class,
+ new Long(qaQueContentId));
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(qaQuestion);
+ }
+
+ public void removeQaQueContent(QaQuestion qaQuestion) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(qaQuestion);
+ }
+}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -37,24 +37,10 @@
*
*/
public class QaSessionDAO extends HibernateDaoSupport implements IQaSessionDAO {
- private static final String COUNT_SESSION_INCOMPLITE = "select qaSession.session_status from QaSession qaSession where qaSession.session_status='INCOMPLETE' and qaSession.qaContentId = :qa";
- private static final String COUNT_SESSION_ACTIVITY = "select qaSession.session_status from QaSession qaSession where qaSession.qaContentId = :qa";
- private static final String GET_SESSION_IDS_FOR_CONTENT = "select qaSession.qaSessionId from QaSession qaSession where qaSession.qaContentId = :qa";
private static final String COUNT_SESSION_COMPLETE = "from qaSession in class QaSession where qaSession.session_status='COMPLETE'";
- private static final String COUNT_SESSION_INCOMPLETE = "from qaSession in class QaSession where qaSession.session_status='INCOMPLETE'";
private static final String GET_SESSIONS_FROM_CONTENT = "select qas.qaSessionId from QaSession qas where qas.qaContent=:qaContent order by qas.qaSessionId";
private static final String GET_SESSIONNAMES_FROM_CONTENT = "select qas.session_name from QaSession qas where qas.qaContent=:qaContent order by qas.qaSessionId";
- public int countSessionComplete() {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(COUNT_SESSION_COMPLETE).list();
-
- if (list != null && list.size() > 0) {
- return list.size();
- } else
- return 0;
- }
-
public int countSessionComplete(QaContent qa) {
HibernateTemplate templ = this.getHibernateTemplate();
List list = getSession().createQuery(COUNT_SESSION_COMPLETE).list();
@@ -66,30 +52,9 @@
++sessionCount;
}
}
- logger.debug("sessionCount: " + sessionCount);
return sessionCount;
}
- public int countSessionIncomplete() {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(COUNT_SESSION_INCOMPLETE).list();
-
- if (list != null && list.size() > 0) {
- return list.size();
- } else
- return 0;
- }
-
- public int studentActivityOccurred(QaContent qa) {
- return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_ACTIVITY, "qa", qa)).size();
- }
-
- public List getToolSessionsForContent(QaContent qa) {
-
- List lisToolSessionIds = (getHibernateTemplate().findByNamedParam(GET_SESSION_IDS_FOR_CONTENT, "qa", qa));
- return lisToolSessionIds;
- }
-
/**
* @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#getSurveySessionById(long)
*/
@@ -105,22 +70,6 @@
return null;
}
- public String getSessionNameById(long qaSessionId) {
- String query = "from QaSession as qus where qus.qaSessionId = ?";
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(query).setLong(0, qaSessionId).list();
-
- if (list != null && list.size() > 0) {
- QaSession qus = (QaSession) list.get(0);
- return qus.getSession_name();
- }
- return null;
- }
-
- public QaSession getQaSessionOrNullById(long qaSessionId) {
- return getQaSessionById(qaSessionId);
- }
-
/**
* @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#CreateSurveySession(com.lamsinternational.tool.survey.domain.SurveySession)
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java
===================================================================
diff -u -rf7b64c7ef2c9cd9db07f7d9c5569a1a663b3fc39 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java (.../QaUploadedFileDAO.java) (revision f7b64c7ef2c9cd9db07f7d9c5569a1a663b3fc39)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java (.../QaUploadedFileDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -23,27 +23,21 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
-import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaUploadedFile;
import org.lamsfoundation.lams.tool.qa.dao.IQaUploadedFileDAO;
-import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* @author Ozgur Demirtas
*
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
*/
public class QaUploadedFileDAO extends HibernateDaoSupport implements IQaUploadedFileDAO {
- static Logger logger = Logger.getLogger(QaUploadedFileDAO.class.getName());
-
private static final String GET_UPLOADED_FILES = "from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContent.qaContentId = :contentId";
public QaUploadedFile getUploadedFileById(long submissionId) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java
===================================================================
diff -u -raa22c03aa1f00c8f79e73f6d47c62fb2c0d00ad0 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision aa22c03aa1f00c8f79e73f6d47c62fb2c0d00ad0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -23,14 +23,11 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
-import java.util.Iterator;
import java.util.List;
import org.hibernate.FlushMode;
-import org.lamsfoundation.lams.tool.qa.QaQueUsr;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
import org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO;
-import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
@@ -39,44 +36,21 @@
*
*/
public class QaUsrRespDAO extends HibernateDaoSupport implements IQaUsrRespDAO {
- private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT = "from qaUsrResp in class QaUsrResp where qaUsrResp.queUsrId=:queUsrId and qaUsrResp.qaQueContentId=:qaQueContentId";
+ private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION = "from qaUsrResp in class QaUsrResp where qaUsrResp.qaQueUser.queUsrId=:queUsrId and qaUsrResp.qaQuestion.uid=:questionId";
+
+ private static final String GET_COUNT_RESPONSES_BY_QACONTENT = "SELECT COUNT(*) from "
+ + QaUsrResp.class.getName() + " as r where r.qaQuestion.qaContent.qaContentId=?";
- public QaQueUsr getUserById(long userId) {
- return (QaQueUsr) this.getHibernateTemplate().load(QaQueUsr.class, new Long(userId));
-
- }
-
public void createUserResponse(QaUsrResp qaUsrResp) {
this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(qaUsrResp);
}
- public QaUsrResp retrieveQaUsrResp(long responseId) {
- return (QaUsrResp) this.getHibernateTemplate().get(QaUsrResp.class, new Long(responseId));
+ public QaUsrResp getResponseById(Long responseId) {
+ return (QaUsrResp) this.getHibernateTemplate().get(QaUsrResp.class, responseId);
}
- public QaUsrResp getAttemptByUID(Long uid) {
- String query = "from QaUsrResp attempt where attempt.responseId=?";
-
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(query).setLong(0, uid.longValue()).list();
-
- if (list != null && list.size() > 0) {
- QaUsrResp attempt = (QaUsrResp) list.get(0);
- return attempt;
- }
- return null;
- }
-
/**
- * @see org.lamsfoundation.lams.tool.qa.dao.interfaces.IQaUsrRespDAO#saveUserResponse(com.lamsinternational.tool.qa.domain.QaUsrResp)
- */
- public void saveUserResponse(QaUsrResp resp) {
- this.getSession().setFlushMode(FlushMode.AUTO);
- this.getHibernateTemplate().save(resp);
- }
-
- /**
* @see org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO#updateUserResponse(org.lamsfoundation.lams.tool.qa.QaUsrResp)
*/
public void updateUserResponse(QaUsrResp resp) {
@@ -89,40 +63,23 @@
this.getHibernateTemplate().delete(resp);
}
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId",
- queUsrId.longValue()).setLong("qaQueContentId", qaQueContentId.longValue()).list();
-
- return list;
- }
-
- public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) {
- HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId",
- queUsrId.longValue()).setLong("qaQueContentId", qaQueContentId.longValue()).list();
-
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
- while (listIterator.hasNext()) {
- QaUsrResp qaUsrResp = (QaUsrResp) listIterator.next();
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(qaUsrResp);
- templ.flush();
- }
+ public QaUsrResp getResponseByUserAndQuestion(final Long queUsrId, final Long questionId) {
+ List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION)
+ .setLong("queUsrId", queUsrId.longValue()).setLong("questionId", questionId.longValue()).list();
+ if (list == null || list.size() == 0) {
+ return null;
+ } else {
+ return (QaUsrResp) list.get(list.size() - 1);
}
}
-
- public void removeUserResponseByQaQueId(Long qaQueId) {
- if (qaQueId != null) {
- String query = "from resp in class org.lamsfoundation.lams.tool.qa.QaUsrResp"
- + " where resp.qaQueContentId = ?";
- Object obj = getSession().createQuery(query).setLong(0, qaQueId.longValue()).uniqueResult();
- if (obj != null) {
- this.getSession().setFlushMode(FlushMode.AUTO);
- getHibernateTemplate().delete(obj);
- }
+
+ public int getCountResponsesByQaContent(final Long qaContentId) {
+
+ List list = getHibernateTemplate().find(GET_COUNT_RESPONSES_BY_QACONTENT, new Object[] { qaContentId });
+ if (list == null || list.size() == 0) {
+ return 0;
}
+ return ((Number) list.get(0)).intValue();
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20110217_updateTo236.sql
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20110217_updateTo236.sql (.../patch20110217_updateTo236.sql) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20110217_updateTo236.sql (.../patch20110217_updateTo236.sql) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -22,6 +22,8 @@
REFERENCES tl_laqa11_usr_resp (uid)
)TYPE=InnoDB;
+-- LDEV-2653 autosave feature
+ALTER TABLE tl_laqa11_usr_resp DROP COLUMN hidden;
UPDATE lams_tool SET tool_version = "20110217" WHERE tool_signature = "laqa11";
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/EditActivityDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/EditActivityDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/EditActivityDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,67 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds question and user attempts data for jsp purposes
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class EditActivityDTO implements Comparable {
+ private String monitoredContentInUse;
+
+ /**
+ * @return Returns the monitoredContentInUse.
+ */
+ public String getMonitoredContentInUse() {
+ return monitoredContentInUse;
+ }
+
+ /**
+ * @param monitoredContentInUse
+ * The monitoredContentInUse to set.
+ */
+ public void setMonitoredContentInUse(String monitoredContentInUse) {
+ this.monitoredContentInUse = monitoredContentInUse;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this).append("monitoredContentInUse", monitoredContentInUse).toString();
+ }
+
+ public int compareTo(Object o) {
+ EditActivityDTO editActivityDTO = (EditActivityDTO) o;
+
+ if (editActivityDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralLearnerFlowDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,714 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds learner flow decision properties and some other view-only
+ * properties
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class GeneralLearnerFlowDTO implements Comparable {
+ protected String activityOffline;
+
+ protected Integer totalQuestionCount;
+
+ protected String activityInstructions;
+
+ protected String activityTitle;
+
+ protected String countSessionComplete;
+
+ protected String userName;
+
+ protected String toolSessionID;
+
+ protected String httpSessionID;
+
+ protected String toolContentID;
+
+ protected Integer currentQuestionIndex;
+
+ protected String questionListingMode;
+
+ protected String currentAnswer;
+
+ protected String remainingQuestionCount;
+
+ protected String teacherViewOnly;
+
+ protected String notebookEntriesVisible;
+
+ protected String reflection;
+
+ protected String reflectionSubject;
+
+ protected String notebookEntry;
+
+ protected String reportTitleLearner;
+
+ protected String endLearningMessage;
+
+ protected String userNameVisible;
+
+ protected String showOtherAnswers;
+
+ protected String requestLearningReport;
+
+ protected String requestLearningReportProgress;
+
+ protected String requestLearningReportViewOnly;
+
+ protected Map mapAnswers;
+
+ protected Map mapAnswersPresentable;
+
+ protected Map mapQuestions;
+
+ protected Map mapQuestionContentLearner;
+
+ protected List listMonitoredAnswersContainerDTO;
+
+ protected String currentMonitoredToolSession;
+
+ protected String initialScreen;
+
+ protected String lockWhenFinished;
+
+ protected String userUid;
+
+ protected String existMultipleUserResponses;
+
+ protected String usernameVisible;
+
+ protected String allowRichEditor;
+
+ protected String allowRateAnswers;
+
+ /**
+ * @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 currentMonitoredToolSession.
+ */
+ public String getCurrentMonitoredToolSession() {
+ return currentMonitoredToolSession;
+ }
+
+ /**
+ * @param currentMonitoredToolSession
+ * The currentMonitoredToolSession to set.
+ */
+ public void setCurrentMonitoredToolSession(String currentMonitoredToolSession) {
+ this.currentMonitoredToolSession = currentMonitoredToolSession;
+ }
+
+ /**
+ * @return Returns the currentAnswer.
+ */
+ public String getCurrentAnswer() {
+ return currentAnswer;
+ }
+
+ /**
+ * @param currentAnswer
+ * The currentAnswer to set.
+ */
+ public void setCurrentAnswer(String currentAnswer) {
+ this.currentAnswer = currentAnswer;
+ }
+
+ protected String userFeedback;
+
+ /**
+ * @return Returns the mapQuestionContentLearner.
+ */
+ public Map getMapQuestionContentLearner() {
+ return mapQuestionContentLearner;
+ }
+
+ /**
+ * @param mapQuestionContentLearner
+ * The mapQuestionContentLearner to set.
+ */
+ public void setMapQuestionContentLearner(Map mapQuestionContentLearner) {
+ this.mapQuestionContentLearner = mapQuestionContentLearner;
+ }
+
+ /**
+ * @return Returns the userFeedback.
+ */
+ public String getUserFeedback() {
+ return userFeedback;
+ }
+
+ /**
+ * @param userFeedback
+ * The userFeedback to set.
+ */
+ public void setUserFeedback(String userFeedback) {
+ this.userFeedback = userFeedback;
+ }
+
+ /**
+ * @return Returns the activityInstructions.
+ */
+ public String getActivityInstructions() {
+ return activityInstructions;
+ }
+
+ /**
+ * @param activityInstructions
+ * The activityInstructions to set.
+ */
+ public void setActivityInstructions(String activityInstructions) {
+ this.activityInstructions = activityInstructions;
+ }
+
+ /**
+ * @return Returns the activityOffline.
+ */
+ public String getActivityOffline() {
+ return activityOffline;
+ }
+
+ /**
+ * @param activityOffline
+ * The activityOffline to set.
+ */
+ public void setActivityOffline(String activityOffline) {
+ this.activityOffline = activityOffline;
+ }
+
+ /**
+ * @return Returns the activityTitle.
+ */
+ public String getActivityTitle() {
+ return activityTitle;
+ }
+
+ /**
+ * @param activityTitle
+ * The activityTitle to set.
+ */
+ public void setActivityTitle(String activityTitle) {
+ this.activityTitle = activityTitle;
+ }
+
+ /**
+ * @return Returns the countSessionComplete.
+ */
+ public String getCountSessionComplete() {
+ return countSessionComplete;
+ }
+
+ /**
+ * @param countSessionComplete
+ * The countSessionComplete to set.
+ */
+ public void setCountSessionComplete(String countSessionComplete) {
+ this.countSessionComplete = countSessionComplete;
+ }
+
+ /**
+ * @return Returns the questionListingMode.
+ */
+ public String getQuestionListingMode() {
+ return questionListingMode;
+ }
+
+ /**
+ * @param questionListingMode
+ * The questionListingMode to set.
+ */
+ public void setQuestionListingMode(String questionListingMode) {
+ this.questionListingMode = questionListingMode;
+ }
+
+ public int compareTo(Object o) {
+ GeneralLearnerFlowDTO gneralLearnerFlowDTO = (GeneralLearnerFlowDTO) o;
+
+ if (gneralLearnerFlowDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this).append("activityOffline: ", activityOffline).append(
+ "remainingQuestionCount: ", remainingQuestionCount).append("totalQuestionCount : ", totalQuestionCount)
+ .append("activityInstructions: ", activityInstructions).append("teacherViewOnly: ", teacherViewOnly)
+ .append("lockWhenFinished: ", lockWhenFinished).append("activityTitle: ", activityTitle).append(
+ "countSessionComplete: ", countSessionComplete).append("toolSessionID: ", toolSessionID)
+ .append("currentQuestionIndex: ", currentQuestionIndex).append("questionListingMode: ",
+ questionListingMode).append("reportTitleLearner: ", reportTitleLearner).append(
+ "userNameVisible: ", userNameVisible).append("requestLearningReport: ", requestLearningReport)
+ .append("requestLearningReportProgress: ", requestLearningReportProgress).append(
+ "requestLearningReportViewOnly: ", requestLearningReportViewOnly).append("mapAnswers: ",
+ mapAnswers).append("mapQuestions: ", mapQuestions).append("mapQuestionContentLearner: ",
+ mapQuestionContentLearner).append("listMonitoredAnswersContainerDTO: ",
+ listMonitoredAnswersContainerDTO).append("currentMonitoredToolSession: ",
+ currentMonitoredToolSession).toString();
+ }
+
+ /**
+ * @param currentQuestionIndex
+ * The currentQuestionIndex to set.
+ */
+ public void setCurrentQuestionIndex(Integer currentQuestionIndex) {
+ this.currentQuestionIndex = currentQuestionIndex;
+ }
+
+ /**
+ * @param totalQuestionCount
+ * The totalQuestionCount to set.
+ */
+ public void setTotalQuestionCount(Integer totalQuestionCount) {
+ this.totalQuestionCount = totalQuestionCount;
+ }
+
+ /**
+ * @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 toolSessionID.
+ */
+ public String getToolSessionID() {
+ return toolSessionID;
+ }
+
+ /**
+ * @param toolSessionID
+ * The toolSessionID to set.
+ */
+ public void setToolSessionID(String toolSessionID) {
+ this.toolSessionID = toolSessionID;
+ }
+
+ /**
+ * @return Returns the currentQuestionIndex.
+ */
+ public Integer getCurrentQuestionIndex() {
+ return currentQuestionIndex;
+ }
+
+ /**
+ * @return Returns the totalQuestionCount.
+ */
+ public Integer getTotalQuestionCount() {
+ return totalQuestionCount;
+ }
+
+ /**
+ * @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 reportTitleLearner.
+ */
+ public String getReportTitleLearner() {
+ return reportTitleLearner;
+ }
+
+ /**
+ * @param reportTitleLearner
+ * The reportTitleLearner to set.
+ */
+ public void setReportTitleLearner(String reportTitleLearner) {
+ this.reportTitleLearner = reportTitleLearner;
+ }
+
+ /**
+ * @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 mapAnswers.
+ */
+ public Map getMapAnswers() {
+ return mapAnswers;
+ }
+
+ /**
+ * @param mapAnswers
+ * The mapAnswers to set.
+ */
+ public void setMapAnswers(Map mapAnswers) {
+ this.mapAnswers = mapAnswers;
+ }
+
+ /**
+ * @return Returns the mapQuestions.
+ */
+ public Map getMapQuestions() {
+ return mapQuestions;
+ }
+
+ /**
+ * @param mapQuestions
+ * The mapQuestions to set.
+ */
+ public void setMapQuestions(Map mapQuestions) {
+ this.mapQuestions = mapQuestions;
+ }
+
+ /**
+ * @return Returns the httpSessionID.
+ */
+ public String getHttpSessionID() {
+ return httpSessionID;
+ }
+
+ /**
+ * @param httpSessionID
+ * The httpSessionID to set.
+ */
+ public void setHttpSessionID(String httpSessionID) {
+ this.httpSessionID = httpSessionID;
+ }
+
+ /**
+ * @return Returns the requestLearningReport.
+ */
+ public String getRequestLearningReport() {
+ return requestLearningReport;
+ }
+
+ /**
+ * @param requestLearningReport
+ * The requestLearningReport to set.
+ */
+ public void setRequestLearningReport(String requestLearningReport) {
+ this.requestLearningReport = requestLearningReport;
+ }
+
+ /**
+ * @return Returns the requestLearningReportProgress.
+ */
+ public String getRequestLearningReportProgress() {
+ return requestLearningReportProgress;
+ }
+
+ /**
+ * @param requestLearningReportProgress
+ * The requestLearningReportProgress to set.
+ */
+ public void setRequestLearningReportProgress(String requestLearningReportProgress) {
+ this.requestLearningReportProgress = requestLearningReportProgress;
+ }
+
+ /**
+ * @return Returns the requestLearningReportViewOnly.
+ */
+ public String getRequestLearningReportViewOnly() {
+ return requestLearningReportViewOnly;
+ }
+
+ /**
+ * @param requestLearningReportViewOnly
+ * The requestLearningReportViewOnly to set.
+ */
+ public void setRequestLearningReportViewOnly(String requestLearningReportViewOnly) {
+ this.requestLearningReportViewOnly = requestLearningReportViewOnly;
+ }
+
+ /**
+ * @return Returns the listMonitoredAnswersContainerDTO.
+ */
+ public List getListMonitoredAnswersContainerDTO() {
+ return listMonitoredAnswersContainerDTO;
+ }
+
+ /**
+ * @param listMonitoredAnswersContainerDTO
+ * The listMonitoredAnswersContainerDTO to set.
+ */
+ public void setListMonitoredAnswersContainerDTO(List listMonitoredAnswersContainerDTO) {
+ this.listMonitoredAnswersContainerDTO = listMonitoredAnswersContainerDTO;
+ }
+
+ /**
+ * @return Returns the mapAnswersPresentable.
+ */
+ public Map getMapAnswersPresentable() {
+ return mapAnswersPresentable;
+ }
+
+ /**
+ * @param mapAnswersPresentable
+ * The mapAnswersPresentable to set.
+ */
+ public void setMapAnswersPresentable(Map mapAnswersPresentable) {
+ this.mapAnswersPresentable = mapAnswersPresentable;
+ }
+
+ /**
+ * @return Returns the reflection.
+ */
+ public String getReflection() {
+ return reflection;
+ }
+
+ /**
+ * @param reflection
+ * The reflection to set.
+ */
+ public void setReflection(String reflection) {
+ this.reflection = reflection;
+ }
+
+ /**
+ * @return Returns the reflectionSubject.
+ */
+ public String getReflectionSubject() {
+ return reflectionSubject;
+ }
+
+ /**
+ * @param reflectionSubject
+ * The reflectionSubject to set.
+ */
+ public void setReflectionSubject(String reflectionSubject) {
+ this.reflectionSubject = reflectionSubject;
+ }
+
+ /**
+ * @return Returns the notebookEntry.
+ */
+ public String getNotebookEntry() {
+ return notebookEntry;
+ }
+
+ /**
+ * @param notebookEntry
+ * The notebookEntry to set.
+ */
+ public void setNotebookEntry(String notebookEntry) {
+ this.notebookEntry = notebookEntry;
+ }
+
+ /**
+ * @return Returns the notebookEntriesVisible.
+ */
+ public String getNotebookEntriesVisible() {
+ return notebookEntriesVisible;
+ }
+
+ /**
+ * @param notebookEntriesVisible
+ * The notebookEntriesVisible to set.
+ */
+ public void setNotebookEntriesVisible(String notebookEntriesVisible) {
+ this.notebookEntriesVisible = notebookEntriesVisible;
+ }
+
+ /**
+ * @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 teacherViewOnly.
+ */
+ public String getTeacherViewOnly() {
+ return teacherViewOnly;
+ }
+
+ /**
+ * @param teacherViewOnly
+ * The teacherViewOnly to set.
+ */
+ public void setTeacherViewOnly(String teacherViewOnly) {
+ this.teacherViewOnly = teacherViewOnly;
+ }
+
+ /**
+ * @return Returns the remainingQuestionCount.
+ */
+ public String getRemainingQuestionCount() {
+ return remainingQuestionCount;
+ }
+
+ /**
+ * @param remainingQuestionCount
+ * The remainingQuestionCount to set.
+ */
+ public void setRemainingQuestionCount(String remainingQuestionCount) {
+ this.remainingQuestionCount = remainingQuestionCount;
+ }
+
+ /**
+ * @return Returns the initialScreen.
+ */
+ public String getInitialScreen() {
+ return initialScreen;
+ }
+
+ /**
+ * @param initialScreen
+ * The initialScreen to set.
+ */
+ public void setInitialScreen(String initialScreen) {
+ this.initialScreen = initialScreen;
+ }
+
+ /**
+ * @return Returns the lockWhenFinished.
+ */
+ public String getLockWhenFinished() {
+ return lockWhenFinished;
+ }
+
+ /**
+ * @param lockWhenFinished
+ * The lockWhenFinished to set.
+ */
+ public void setLockWhenFinished(String lockWhenFinished) {
+ this.lockWhenFinished = lockWhenFinished;
+ }
+
+ /**
+ * @return Returns the showOtherAnswers.
+ */
+ public String getShowOtherAnswers() {
+ return showOtherAnswers;
+ }
+
+ /**
+ * @param showOtherAnswers
+ * The showOtherAnswers to set.
+ */
+ public void setShowOtherAnswers(String showOtherAnswers) {
+ this.showOtherAnswers = showOtherAnswers;
+ }
+
+ /**
+ * @return Returns the userUid.
+ */
+ public String getUserUid() {
+ return userUid;
+ }
+
+ /**
+ * @param userUid
+ * The userUid to set.
+ */
+ public void setUserUid(String userUid) {
+ this.userUid = userUid;
+ }
+
+ /**
+ * @return Returns the existMultipleUserResponses.
+ */
+ public String getExistMultipleUserResponses() {
+ return existMultipleUserResponses;
+ }
+
+ /**
+ * @param existMultipleUserResponses
+ * The existMultipleUserResponses to set.
+ */
+ public void setExistMultipleUserResponses(String existMultipleUserResponses) {
+ this.existMultipleUserResponses = existMultipleUserResponses;
+ }
+
+ public String getAllowRichEditor() {
+ return allowRichEditor;
+ }
+
+ public void setAllowRichEditor(String allowRichEditor) {
+ this.allowRichEditor = allowRichEditor;
+ }
+
+ public String getAllowRateAnswers() {
+ return allowRateAnswers;
+ }
+
+ public void setAllowRateAnswers(String allowRateAnswers) {
+ this.allowRateAnswers = allowRateAnswers;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralMonitoringDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralMonitoringDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/GeneralMonitoringDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,291 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+
+import java.util.List;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ *
DTO that holds learner flow decision properties and some other view-only properties
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class GeneralMonitoringDTO implements Comparable
+{
+ protected String userExceptionNoToolSessions;
+ protected String userExceptionNoStudentActivity;
+ protected String userExceptionContentInUse;
+ protected String monitoredContentInUse;
+
+ protected String defineLaterInEditMode;
+
+ protected String countAllUsers;
+ protected String countSessionComplete;
+
+ protected String activityTitle;
+ protected String activityInstructions;
+
+ protected String editResponse;
+
+ protected String defaultQuestionContent;
+
+ protected String onlineInstructions;
+ protected String offlineInstructions;
+
+ protected List attachmentList;
+ protected List deletedAttachmentList;
+
+ protected String contentFolderID;
+
+
+ public String toString() {
+ return new ToStringBuilder(this)
+ .append("userExceptionNoToolSessions: ", userExceptionNoToolSessions)
+ .append("userExceptionNoStudentActivity: ", userExceptionNoStudentActivity)
+ .append("userExceptionContentInUse: ", userExceptionContentInUse)
+ .append("defineLaterInEditMode: ", defineLaterInEditMode)
+ .append("monitoredContentInUse: ", monitoredContentInUse)
+ .append("activityTitle: ", activityTitle)
+ .append("activityInstructions: ", activityInstructions)
+ .append("editResponse: ", editResponse)
+ .append("defaultQuestionContent: ", defaultQuestionContent)
+ .append("countAllUsers: ", countAllUsers)
+ .append("countSessionComplete: ", countSessionComplete)
+ .append("onlineInstructions: ", onlineInstructions)
+ .append("offlineInstructions: ", offlineInstructions)
+ .append("attachmentList: ", attachmentList)
+ .append("deletedAttachmentList: ", deletedAttachmentList)
+ .toString();
+ }
+
+ public int compareTo(Object o)
+ {
+ GeneralMonitoringDTO generalMonitoringDTO = (GeneralMonitoringDTO) o;
+
+ if (generalMonitoringDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+
+ /**
+ * @return Returns the defineLaterInEditMode.
+ */
+ public String getDefineLaterInEditMode() {
+ return defineLaterInEditMode;
+ }
+ /**
+ * @param defineLaterInEditMode The defineLaterInEditMode to set.
+ */
+ public void setDefineLaterInEditMode(String defineLaterInEditMode) {
+ this.defineLaterInEditMode = defineLaterInEditMode;
+ }
+ /**
+ * @return Returns the monitoredContentInUse.
+ */
+ public String getMonitoredContentInUse() {
+ return monitoredContentInUse;
+ }
+ /**
+ * @param monitoredContentInUse The monitoredContentInUse to set.
+ */
+ public void setMonitoredContentInUse(String monitoredContentInUse) {
+ this.monitoredContentInUse = monitoredContentInUse;
+ }
+ /**
+ * @return Returns the userExceptionContentInUse.
+ */
+ public String getUserExceptionContentInUse() {
+ return userExceptionContentInUse;
+ }
+ /**
+ * @param userExceptionContentInUse The userExceptionContentInUse to set.
+ */
+ public void setUserExceptionContentInUse(String userExceptionContentInUse) {
+ this.userExceptionContentInUse = userExceptionContentInUse;
+ }
+ /**
+ * @return Returns the editResponse.
+ */
+ public String getEditResponse() {
+ return editResponse;
+ }
+ /**
+ * @param editResponse The editResponse to set.
+ */
+ public void setEditResponse(String editResponse) {
+ this.editResponse = editResponse;
+ }
+ /**
+ * @return Returns the defaultQuestionContent.
+ */
+ public String getDefaultQuestionContent() {
+ return defaultQuestionContent;
+ }
+ /**
+ * @param defaultQuestionContent The defaultQuestionContent to set.
+ */
+ public void setDefaultQuestionContent(String defaultQuestionContent) {
+ this.defaultQuestionContent = defaultQuestionContent;
+ }
+ /**
+ * @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 attachmentList.
+ */
+ public List getAttachmentList() {
+ return attachmentList;
+ }
+ /**
+ * @param attachmentList The attachmentList to set.
+ */
+ public void setAttachmentList(List attachmentList) {
+ this.attachmentList = attachmentList;
+ }
+ /**
+ * @return Returns the deletedAttachmentList.
+ */
+ public List getDeletedAttachmentList() {
+ return deletedAttachmentList;
+ }
+ /**
+ * @param deletedAttachmentList The deletedAttachmentList to set.
+ */
+ public void setDeletedAttachmentList(List deletedAttachmentList) {
+ this.deletedAttachmentList = deletedAttachmentList;
+ }
+ /**
+ * @return Returns the userExceptionNoStudentActivity.
+ */
+ public String getUserExceptionNoStudentActivity() {
+ return userExceptionNoStudentActivity;
+ }
+ /**
+ * @param userExceptionNoStudentActivity The userExceptionNoStudentActivity to set.
+ */
+ public void setUserExceptionNoStudentActivity(
+ String userExceptionNoStudentActivity) {
+ this.userExceptionNoStudentActivity = userExceptionNoStudentActivity;
+ }
+ /**
+ * @return Returns the countAllUsers.
+ */
+ public String getCountAllUsers() {
+ return countAllUsers;
+ }
+ /**
+ * @param countAllUsers The countAllUsers to set.
+ */
+ public void setCountAllUsers(String countAllUsers) {
+ this.countAllUsers = countAllUsers;
+ }
+ /**
+ * @return Returns the countSessionComplete.
+ */
+ public String getCountSessionComplete() {
+ return countSessionComplete;
+ }
+ /**
+ * @param countSessionComplete The countSessionComplete to set.
+ */
+ public void setCountSessionComplete(String countSessionComplete) {
+ this.countSessionComplete = countSessionComplete;
+ }
+ /**
+ * @return Returns the userExceptionNoToolSessions.
+ */
+ public String getUserExceptionNoToolSessions() {
+ return userExceptionNoToolSessions;
+ }
+ /**
+ * @param userExceptionNoToolSessions The userExceptionNoToolSessions to set.
+ */
+ public void setUserExceptionNoToolSessions(
+ String userExceptionNoToolSessions) {
+ this.userExceptionNoToolSessions = userExceptionNoToolSessions;
+ }
+ /**
+ * @return Returns the activityInstructions.
+ */
+ public String getActivityInstructions() {
+ return activityInstructions;
+ }
+ /**
+ * @param activityInstructions The activityInstructions to set.
+ */
+ public void setActivityInstructions(String activityInstructions) {
+ this.activityInstructions = activityInstructions;
+ }
+ /**
+ * @return Returns the activityTitle.
+ */
+ public String getActivityTitle() {
+ return activityTitle;
+ }
+ /**
+ * @param activityTitle The activityTitle to set.
+ */
+ public void setActivityTitle(String activityTitle) {
+ this.activityTitle = activityTitle;
+ }
+ /**
+ * @return Returns the contentFolderID.
+ */
+ public String getContentFolderID() {
+ return contentFolderID;
+ }
+ /**
+ * @param contentFolderID The contentFolderID to set.
+ */
+ public void setContentFolderID(String contentFolderID) {
+ this.contentFolderID = contentFolderID;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaAllGroupsDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaAllGroupsDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaAllGroupsDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,104 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.List;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds question and user attempts data for jsp purposes
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaAllGroupsDTO implements Comparable {
+
+ private String sessionId;
+
+ private String sessionName;
+
+ private List groupData;
+
+ public String toString() {
+ return new ToStringBuilder(this).append("sessionId:", sessionId).append("sessionName:", sessionName).append(
+ "groupData: ", groupData).toString();
+ }
+
+ public int compareTo(Object o) {
+ QaAllGroupsDTO qaAllGroupsDTO = (QaAllGroupsDTO) o;
+
+ if (qaAllGroupsDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+ /**
+ * @return Returns the groupData.
+ */
+ public List getGroupData() {
+ return groupData;
+ }
+
+ /**
+ * @param groupData
+ * The groupData to set.
+ */
+ public void setGroupData(List groupData) {
+ this.groupData = groupData;
+ }
+
+ /**
+ * @return Returns the sessionName.
+ */
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ /**
+ * @param sessionName
+ * The sessionName to set.
+ */
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+
+ /**
+ * @return Returns the sessionId.
+ */
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ /**
+ * @param sessionId
+ * The sessionId to set.
+ */
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaConditionDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaConditionDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaConditionDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,58 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.lamsfoundation.lams.learningdesign.dto.TextSearchConditionDTO;
+import org.lamsfoundation.lams.tool.qa.QaCondition;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
+import org.lamsfoundation.lams.tool.qa.util.QaQueContentComparator;
+
+public class QaConditionDTO extends TextSearchConditionDTO {
+ private Set questions = new TreeSet(new QaQueContentComparator());
+
+ public QaConditionDTO(QaCondition condition, Integer toolActivityUIID) {
+ super(condition, toolActivityUIID);
+ for (QaQuestion question : condition.getQuestions()) {
+ QaQuestion questionCopy = new QaQuestion(question.getQuestion(), question.getDisplayOrder(), null,
+ question.isRequired(), null, null);
+ getQuestions().add(questionCopy);
+ }
+ }
+
+ public Set getQuestions() {
+ return questions;
+ }
+
+ public void setQuestions(Set questions) {
+ this.questions = questions;
+ }
+
+ @Override
+ public QaCondition getCondition() {
+ return new QaCondition(this);
+ }
+}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaGeneralAuthoringDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaGeneralAuthoringDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaGeneralAuthoringDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,615 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.List;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds authoring properties for authoring jsps
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaGeneralAuthoringDTO implements Comparable {
+ protected String toolContentID;
+ protected String currentTab;
+ protected String activeModule;
+ protected String defineLaterInEditMode;
+ protected String showAuthoringTabs;
+ protected String monitoringOriginatedDefineLater;
+ protected String targetMode;
+ protected String defaultQuestionContent;
+ protected String defaultContentIdStr;
+
+ protected String activityTitle;
+ protected String activityInstructions;
+ protected String onlineInstructions;
+ protected String offlineInstructions;
+ protected String usernameVisible;
+ protected String allowRateAnswers;
+ protected String showOtherAnswers;
+ protected String reflect;
+ protected String synchInMonitor;
+ protected String questionsSequenced;
+ protected String lockWhenFinished;
+ protected String editActivityEditMode;
+ protected String reflectionSubject;
+ protected Boolean allowRichEditor;
+
+ protected String monitoredContentInUse;
+
+ protected String httpSessionID;
+ protected String requestedModule;
+ protected String isDefineLater;
+
+ protected List attachmentList;
+ protected List deletedAttachmentList;
+
+ protected String sbmtSuccess;
+ protected String userExceptionQuestionsDuplicate;
+
+ protected String contentFolderID;
+ protected String editableQuestionText;
+ protected String editableQuestionFeedback;
+
+ public String toString() {
+ return new ToStringBuilder(this).append("toolContentID: ", toolContentID)
+ .append("contentFolderID: ", contentFolderID).append("httpSessionID: ", httpSessionID)
+ .append("currentTab: ", currentTab).append("activeModule: ", activeModule)
+ .append("defineLaterInEditMode: ", defineLaterInEditMode)
+ .append("showAuthoringTabs: ", showAuthoringTabs)
+ .append("monitoringOriginatedDefineLater: ", monitoringOriginatedDefineLater)
+ .append("targetMode: ", targetMode).append("defaultQuestionContent: ", defaultQuestionContent)
+ .append("defaultContentIdStr: ", defaultContentIdStr).append("activityTitle: ", activityTitle)
+ .append("activityInstructions: ", activityInstructions).append("reflect: ", reflect)
+ .append("onlineInstructions: ", onlineInstructions)
+ .append("offlineInstructions: ", offlineInstructions).append("usernameVisible: ", usernameVisible)
+ .append("allowRateAnswers: ", allowRateAnswers).append("showOtherAnswers: ", showOtherAnswers)
+ .append("synchInMonitor: ", synchInMonitor).append("questionsSequenced: ", questionsSequenced)
+ .append("lockWhenFinished: ", lockWhenFinished).append("editActivityEditMode: ", editActivityEditMode)
+ .append("reflectionSubject: ", reflectionSubject).append("requestedModule: ", requestedModule)
+ .append("isDefineLater: ", isDefineLater).append("monitoredContentInUse: ", monitoredContentInUse)
+ .append("attachmentList: ", attachmentList).append("deletedAttachmentList: ", deletedAttachmentList)
+ .append("sbmtSuccess: ", sbmtSuccess)
+ .append("userExceptionQuestionsDuplicate: ", userExceptionQuestionsDuplicate).toString();
+ }
+
+ /**
+ * @return Returns the userExceptionQuestionsDuplicate.
+ */
+ public String getUserExceptionQuestionsDuplicate() {
+ return userExceptionQuestionsDuplicate;
+ }
+
+ /**
+ * @param userExceptionQuestionsDuplicate
+ * The userExceptionQuestionsDuplicate to set.
+ */
+ public void setUserExceptionQuestionsDuplicate(String userExceptionQuestionsDuplicate) {
+ this.userExceptionQuestionsDuplicate = userExceptionQuestionsDuplicate;
+ }
+
+ /**
+ * @return Returns the httpSessionID.
+ */
+ public String getHttpSessionID() {
+ return httpSessionID;
+ }
+
+ /**
+ * @param httpSessionID
+ * The httpSessionID to set.
+ */
+ public void setHttpSessionID(String httpSessionID) {
+ this.httpSessionID = httpSessionID;
+ }
+
+ /**
+ * @return Returns the monitoredContentInUse.
+ */
+ public String getMonitoredContentInUse() {
+ return monitoredContentInUse;
+ }
+
+ /**
+ * @param monitoredContentInUse
+ * The monitoredContentInUse to set.
+ */
+ public void setMonitoredContentInUse(String monitoredContentInUse) {
+ this.monitoredContentInUse = monitoredContentInUse;
+ }
+
+ /**
+ * @return Returns the editActivityEditMode.
+ */
+ public String getEditActivityEditMode() {
+ return editActivityEditMode;
+ }
+
+ /**
+ * @param editActivityEditMode
+ * The editActivityEditMode to set.
+ */
+ public void setEditActivityEditMode(String editActivityEditMode) {
+ this.editActivityEditMode = editActivityEditMode;
+ }
+
+ /**
+ * @return Returns the deletedAttachmentList.
+ */
+ public List getDeletedAttachmentList() {
+ return deletedAttachmentList;
+ }
+
+ /**
+ * @param deletedAttachmentList
+ * The deletedAttachmentList to set.
+ */
+ public void setDeletedAttachmentList(List deletedAttachmentList) {
+ this.deletedAttachmentList = deletedAttachmentList;
+ }
+
+ /**
+ * @return Returns the isDefineLater.
+ */
+ public String getIsDefineLater() {
+ return isDefineLater;
+ }
+
+ /**
+ * @param isDefineLater
+ * The isDefineLater to set.
+ */
+ public void setIsDefineLater(String isDefineLater) {
+ this.isDefineLater = isDefineLater;
+ }
+
+ /**
+ * @return Returns the attachmentList.
+ */
+ public List getAttachmentList() {
+ return attachmentList;
+ }
+
+ /**
+ * @param attachmentList
+ * The attachmentList to set.
+ */
+ public void setAttachmentList(List attachmentList) {
+ this.attachmentList = attachmentList;
+ }
+
+ /**
+ * @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 targetMode.
+ */
+ public String getTargetMode() {
+ return targetMode;
+ }
+
+ /**
+ * @param targetMode
+ * The targetMode to set.
+ */
+ public void setTargetMode(String targetMode) {
+ this.targetMode = targetMode;
+ }
+
+ /**
+ * @return Returns the monitoringOriginatedDefineLater.
+ */
+ public String getMonitoringOriginatedDefineLater() {
+ return monitoringOriginatedDefineLater;
+ }
+
+ /**
+ * @param monitoringOriginatedDefineLater
+ * The monitoringOriginatedDefineLater to set.
+ */
+ public void setMonitoringOriginatedDefineLater(String monitoringOriginatedDefineLater) {
+ this.monitoringOriginatedDefineLater = monitoringOriginatedDefineLater;
+ }
+
+ /**
+ * @return Returns the activeModule.
+ */
+ public String getActiveModule() {
+ return activeModule;
+ }
+
+ /**
+ * @param activeModule
+ * The activeModule to set.
+ */
+ public void setActiveModule(String activeModule) {
+ this.activeModule = activeModule;
+ }
+
+ /**
+ * @return Returns the defineLaterInEditMode.
+ */
+ public String getDefineLaterInEditMode() {
+ return defineLaterInEditMode;
+ }
+
+ /**
+ * @param defineLaterInEditMode
+ * The defineLaterInEditMode to set.
+ */
+ public void setDefineLaterInEditMode(String defineLaterInEditMode) {
+ this.defineLaterInEditMode = defineLaterInEditMode;
+ }
+
+ /**
+ * @return Returns the showAuthoringTabs.
+ */
+ public String getShowAuthoringTabs() {
+ return showAuthoringTabs;
+ }
+
+ /**
+ * @param showAuthoringTabs
+ * The showAuthoringTabs to set.
+ */
+ public void setShowAuthoringTabs(String showAuthoringTabs) {
+ this.showAuthoringTabs = showAuthoringTabs;
+ }
+
+ public int compareTo(Object o) {
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO) o;
+
+ if (qaGeneralAuthoringDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+ /**
+ * @return Returns the defaultContentIdStr.
+ */
+ public String getDefaultContentIdStr() {
+ return defaultContentIdStr;
+ }
+
+ /**
+ * @param defaultContentIdStr
+ * The defaultContentIdStr to set.
+ */
+ public void setDefaultContentIdStr(String defaultContentIdStr) {
+ this.defaultContentIdStr = defaultContentIdStr;
+ }
+
+ /**
+ * @return Returns the defaultQuestionContent.
+ */
+ public String getDefaultQuestionContent() {
+ return defaultQuestionContent;
+ }
+
+ /**
+ * @param defaultQuestionContent
+ * The defaultQuestionContent to set.
+ */
+ public void setDefaultQuestionContent(String defaultQuestionContent) {
+ this.defaultQuestionContent = defaultQuestionContent;
+ }
+
+ /**
+ * @return Returns the requestedModule.
+ */
+ public String getRequestedModule() {
+ return requestedModule;
+ }
+
+ /**
+ * @param requestedModule
+ * The requestedModule to set.
+ */
+ public void setRequestedModule(String requestedModule) {
+ this.requestedModule = requestedModule;
+ }
+
+ /**
+ * @return Returns the activityInstructions.
+ */
+ public String getActivityInstructions() {
+ return activityInstructions;
+ }
+
+ /**
+ * @param activityInstructions
+ * The activityInstructions to set.
+ */
+ public void setActivityInstructions(String activityInstructions) {
+ this.activityInstructions = activityInstructions;
+ }
+
+ /**
+ * @return Returns the activityTitle.
+ */
+ public String getActivityTitle() {
+ return activityTitle;
+ }
+
+ /**
+ * @param activityTitle
+ * The activityTitle to set.
+ */
+ public void setActivityTitle(String activityTitle) {
+ this.activityTitle = activityTitle;
+ }
+
+ /**
+ * @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 questionsSequenced.
+ */
+ public String getQuestionsSequenced() {
+ return questionsSequenced;
+ }
+
+ /**
+ * @param questionsSequenced
+ * The questionsSequenced to set.
+ */
+ public void setQuestionsSequenced(String questionsSequenced) {
+ this.questionsSequenced = questionsSequenced;
+ }
+
+ /**
+ * @return Returns the synchInMonitor.
+ */
+ public String getSynchInMonitor() {
+ return synchInMonitor;
+ }
+
+ /**
+ * @param synchInMonitor
+ * The synchInMonitor to set.
+ */
+ public void setSynchInMonitor(String synchInMonitor) {
+ this.synchInMonitor = synchInMonitor;
+ }
+
+ /**
+ * @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 allowRateAnswers.
+ */
+ public String getAllowRateAnswers() {
+ return allowRateAnswers;
+ }
+
+ /**
+ * @param allowRateAnswers
+ * The allowRateAnswers to set.
+ */
+ public void setAllowRateAnswers(String allowRateAnswers) {
+ this.allowRateAnswers = allowRateAnswers;
+ }
+
+ /**
+ * @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 sbmtSuccess.
+ */
+ public String getSbmtSuccess() {
+ return sbmtSuccess;
+ }
+
+ /**
+ * @param sbmtSuccess
+ * The sbmtSuccess to set.
+ */
+ public void setSbmtSuccess(String sbmtSuccess) {
+ this.sbmtSuccess = sbmtSuccess;
+ }
+
+ /**
+ * @return Returns the contentFolderID.
+ */
+ public String getContentFolderID() {
+ return contentFolderID;
+ }
+
+ /**
+ * @param contentFolderID
+ * The contentFolderID to set.
+ */
+ public void setContentFolderID(String contentFolderID) {
+ this.contentFolderID = contentFolderID;
+ }
+
+ /**
+ * @return Returns the editableQuestionText.
+ */
+ public String getEditableQuestionText() {
+ return editableQuestionText;
+ }
+
+ /**
+ * @param editableQuestionText
+ * The editableQuestionText to set.
+ */
+ public void setEditableQuestionText(String editableQuestionText) {
+ this.editableQuestionText = editableQuestionText;
+ }
+
+ /**
+ * @return Returns the editableQuestionFeedback.
+ */
+ public String getEditableQuestionFeedback() {
+ return editableQuestionFeedback;
+ }
+
+ /**
+ * @param editableQuestionFeedback
+ * The editableQuestionFeedback to set.
+ */
+ public void setEditableQuestionFeedback(String editableQuestionFeedback) {
+ this.editableQuestionFeedback = editableQuestionFeedback;
+ }
+
+ /**
+ * @return Returns the reflect.
+ */
+ public String getReflect() {
+ return reflect;
+ }
+
+ /**
+ * @param reflect
+ * The reflect to set.
+ */
+ public void setReflect(String reflect) {
+ this.reflect = reflect;
+ }
+
+ /**
+ * @return Returns the reflectionSubject.
+ */
+ public String getReflectionSubject() {
+ return reflectionSubject;
+ }
+
+ /**
+ * @param reflectionSubject
+ * The reflectionSubject to set.
+ */
+ public void setReflectionSubject(String reflectionSubject) {
+ this.reflectionSubject = reflectionSubject;
+ }
+
+ /**
+ * @return Returns the lockWhenFinished.
+ */
+ public String getLockWhenFinished() {
+ return lockWhenFinished;
+ }
+
+ /**
+ * @param lockWhenFinished
+ * The lockWhenFinished to set.
+ */
+ public void setLockWhenFinished(String lockWhenFinished) {
+ this.lockWhenFinished = lockWhenFinished;
+ }
+
+ /**
+ * @return Returns the showOtherAnswers.
+ */
+ public String getShowOtherAnswers() {
+ return showOtherAnswers;
+ }
+
+ /**
+ * @param showOtherAnswers
+ * The showOtherAnswers to set.
+ */
+ public void setShowOtherAnswers(String showOtherAnswers) {
+ this.showOtherAnswers = showOtherAnswers;
+ }
+
+ public Boolean getAllowRichEditor() {
+ return allowRichEditor;
+ }
+
+ public void setAllowRichEditor(Boolean allowRichEditor) {
+ this.allowRichEditor = allowRichEditor;
+ }
+
+
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredAnswersDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredAnswersDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredAnswersDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,156 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.Map;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds question and user attempts data for jsp purposes
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaMonitoredAnswersDTO implements Comparable {
+ private String sessionId;
+
+ private String sessionName;
+
+ private String questionUid;
+
+ private String question;
+
+ private String feedback;
+
+ private Map questionAttempts;
+
+ /**
+ * @return Returns the question.
+ */
+ public String getQuestion() {
+ return question;
+ }
+
+ /**
+ * @param question
+ * The question to set.
+ */
+ public void setQuestion(String question) {
+ this.question = question;
+ }
+
+ /**
+ *
+ * @return Returns the feedback.
+ */
+ public String getFeedback() {
+ return feedback;
+ }
+
+ /**
+ * @param feedback
+ * The feedback to set.
+ */
+ public void setFeedback(String feedback) {
+ this.feedback = feedback;
+ }
+
+ /**
+ * @return Returns the questionUid.
+ */
+ public String getQuestionUid() {
+ return questionUid;
+ }
+
+ /**
+ * @param questionUid
+ * The questionUid to set.
+ */
+ public void setQuestionUid(String questionUid) {
+ this.questionUid = questionUid;
+ }
+
+ /**
+ * @return Returns the questionAttempts.
+ */
+ public Map getQuestionAttempts() {
+ return questionAttempts;
+ }
+
+ /**
+ * @param questionAttempts
+ * The questionAttempts to set.
+ */
+ public void setQuestionAttempts(Map questionAttempts) {
+ this.questionAttempts = questionAttempts;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this).append("sessionName:", sessionName).append("sessionId:", sessionId).append(
+ "questionUid:", questionUid).append("question:", question)
+ .append("questionAttempts:", questionAttempts).toString();
+ }
+
+ public int compareTo(Object o) {
+ QaMonitoredAnswersDTO qaMonitoredAnswersDTO = (QaMonitoredAnswersDTO) o;
+
+ if (qaMonitoredAnswersDTO == null)
+ return 1;
+ else
+ return (int) (new Long(questionUid).longValue() - new Long(qaMonitoredAnswersDTO.questionUid).longValue());
+ }
+
+ /**
+ * @return Returns the sessionId.
+ */
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ /**
+ * @param sessionId
+ * The sessionId to set.
+ */
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * @return Returns the sessionName.
+ */
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ /**
+ * @param sessionName
+ * The sessionName to set.
+ */
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredUserDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredUserDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaMonitoredUserDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,293 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds users attempt history data for jsp purposes
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaMonitoredUserDTO implements Comparable {
+ private String queUsrId;
+
+ private String uid;
+
+ //private String attemptTime;
+
+ private Date attemptTime;
+
+ private String timeZone;
+
+ private String userName;
+
+ private String isCorrect;
+
+ private String response;
+
+ private String responsePresentable;
+
+ private String sessionId;
+
+ private String questionUid;
+
+ private String visible;
+
+ private String averageRating;
+
+ private String numberOfVotes;
+
+ private Map usersAttempts;
+
+ /**
+ * @return Returns the queUsrId.
+ */
+ public String getQueUsrId() {
+ return queUsrId;
+ }
+
+ /**
+ * @param queUsrId
+ * The queUsrId to set.
+ */
+ public void setQueUsrId(String queUsrId) {
+ this.queUsrId = queUsrId;
+ }
+
+ public String toString() {
+ return new ToStringBuilder(this).append("sessionId:", sessionId).append("userName:", userName).append(
+ "queUsrId:", queUsrId).append("questionUid:", questionUid).append("response:", response).append(
+ "visible:", visible).append("usersAttempts:", usersAttempts).toString();
+ }
+
+ /**
+ * @return Returns the usersAttempts.
+ */
+ public Map getUsersAttempts() {
+ return usersAttempts;
+ }
+
+ /**
+ * @param usersAttempts
+ * The usersAttempts to set.
+ */
+ public void setUsersAttempts(Map usersAttempts) {
+ this.usersAttempts = usersAttempts;
+ }
+
+ public int compareTo(Object o) {
+ QaMonitoredUserDTO qaMonitoredUserDTO = (QaMonitoredUserDTO) o;
+
+ if (qaMonitoredUserDTO == null)
+ return 1;
+ else
+ return (int) (new Long(queUsrId).longValue() - new Long(qaMonitoredUserDTO.queUsrId).longValue());
+ }
+
+ /**
+ * @return Returns the isCorrect.
+ */
+ public String getIsCorrect() {
+ return isCorrect;
+ }
+
+ /**
+ * @param isCorrect
+ * The isCorrect to set.
+ */
+ public void setIsCorrect(String isCorrect) {
+ this.isCorrect = isCorrect;
+ }
+
+ /**
+ * @return Returns the response.
+ */
+ public String getResponse() {
+ return response;
+ }
+
+ /**
+ * @param response
+ * The response to set.
+ */
+ public void setResponse(String response) {
+ this.response = response;
+ }
+
+ /**
+ * @return Returns the timeZone.
+ */
+ public String getTimeZone() {
+ return timeZone;
+ }
+
+ /**
+ * @param timeZone
+ * The timeZone to set.
+ */
+ public void setTimeZone(String timeZone) {
+ this.timeZone = timeZone;
+ }
+
+ /**
+ * @return Returns the uid.
+ */
+ public String getUid() {
+ return uid;
+ }
+
+ /**
+ * @param uid
+ * The uid to set.
+ */
+ public void setUid(String uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @return Returns the userName.
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @param userName
+ * The userName to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ /**
+ * @return Returns the sessionId.
+ */
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ /**
+ * @param sessionId
+ * The sessionId to set.
+ */
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * @return Returns the questionUid.
+ */
+ public String getQuestionUid() {
+ return questionUid;
+ }
+
+ /**
+ * @param questionUid
+ * The questionUid to set.
+ */
+ public void setQuestionUid(String questionUid) {
+ this.questionUid = questionUid;
+ }
+
+ /**
+ * @return Returns the visible.
+ */
+ public String getVisible() {
+ return visible;
+ }
+
+ /**
+ * @param visible
+ * The visible to set.
+ */
+ public void setVisible(String visible) {
+ this.visible = visible;
+ }
+
+ /**
+ * @return Returns the averageRating.
+ */
+ public String getAverageRating() {
+ return averageRating;
+ }
+
+ /**
+ * @param averageRating
+ * The averageRating to set.
+ */
+ public void setAverageRating(String averageRating) {
+ this.averageRating = averageRating;
+ }
+
+ /**
+ * @return Returns the numberOfVotes.
+ */
+ public String getNumberOfVotes() {
+ return numberOfVotes;
+ }
+
+ /**
+ * @param numberOfVotes
+ * The numberOfVotes to set.
+ */
+ public void setNumberOfVotes(String numberOfVotes) {
+ this.numberOfVotes = numberOfVotes;
+ }
+
+ /**
+ * @return Returns the attemptTime.
+ */
+ public Date getAttemptTime() {
+ return attemptTime;
+ }
+
+ /**
+ * @param attemptTime
+ * The attemptTime to set.
+ */
+ public void setAttemptTime(Date attemptTime) {
+ this.attemptTime = attemptTime;
+ }
+
+ /**
+ * @return Returns the responsePresentable.
+ */
+ public String getResponsePresentable() {
+ return responsePresentable;
+ }
+
+ /**
+ * @param responsePresentable
+ * The responsePresentable to set.
+ */
+ public void setResponsePresentable(String responsePresentable) {
+ this.responsePresentable = responsePresentable;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaQuestionDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaQuestionDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaQuestionDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,146 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
+
+/**
+ *
+ * DTO that holds users attempt history data for jsp purposes
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaQuestionDTO implements Comparable {
+ 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).append("required:", Boolean.toString(required)).toString();
+ }
+
+ public QaQuestionDTO(QaQuestion que) {
+ this.question = que.getQuestion();
+ this.displayOrder = new Integer(que.getDisplayOrder()).toString();
+ this.feedback = que.getFeedback() != null ? que.getFeedback() : " ";
+ this.required = que.isRequired();
+ }
+
+ public QaQuestionDTO(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;
+
+ if (qaMonitoredUserDTO == null) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * @return Returns the displayOrder.
+ */
+ public String getDisplayOrder() {
+ return displayOrder;
+ }
+
+ /**
+ * @param displayOrder
+ * The displayOrder to set.
+ */
+ public void setDisplayOrder(String displayOrder) {
+ this.displayOrder = displayOrder;
+ }
+
+ /**
+ * @return Returns the feedback.
+ */
+ public String getFeedback() {
+ return feedback;
+ }
+
+ /**
+ * @param feedback
+ * The feedback to set.
+ */
+ public void setFeedback(String feedback) {
+ this.feedback = feedback;
+ }
+
+ /**
+ * @return Returns the question.
+ */
+ public String getQuestion() {
+ return question;
+ }
+
+ /**
+ * @param question
+ * The question to set.
+ */
+ public void setQuestion(String question) {
+ 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 QaQuestionDTO) {
+ QaQuestionDTO compare = (QaQuestionDTO) o;
+ return compare.getDisplayOrder().equals(getDisplayOrder());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return new Integer(getDisplayOrder());
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaStatsDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaStatsDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaStatsDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,84 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds stats data
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+public class QaStatsDTO implements Comparable {
+ private String countAllUsers;
+
+ private String countSessionComplete;
+
+ public String toString() {
+ return new ToStringBuilder(this).append("question", countAllUsers).append("countSessionComplete",
+ countSessionComplete).toString();
+ }
+
+ public int compareTo(Object o) {
+ QaStatsDTO qaStatsDTO = (QaStatsDTO) o;
+
+ if (qaStatsDTO == null)
+ return 1;
+ else
+ return 0;
+ }
+
+ /**
+ * @return Returns the countAllUsers.
+ */
+ public String getCountAllUsers() {
+ return countAllUsers;
+ }
+
+ /**
+ * @param countAllUsers
+ * The countAllUsers to set.
+ */
+ public void setCountAllUsers(String countAllUsers) {
+ this.countAllUsers = countAllUsers;
+ }
+
+ /**
+ * @return Returns the countSessionComplete.
+ */
+ public String getCountSessionComplete() {
+ return countSessionComplete;
+ }
+
+ /**
+ * @param countSessionComplete
+ * The countSessionComplete to set.
+ */
+ public void setCountSessionComplete(String countSessionComplete) {
+ this.countSessionComplete = countSessionComplete;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaWizardDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaWizardDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/QaWizardDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Copyright (C) 2008 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import java.io.Serializable;
+import java.util.SortedSet;
+
+import org.lamsfoundation.lams.tool.qa.QaWizardCategory;
+
+public class QaWizardDTO implements Serializable {
+
+ public static final long serialVersionUID = 3481234912412784515L;
+
+ SortedSet qaWizardCategories;
+
+ public QaWizardDTO() {
+ }
+
+ public QaWizardDTO(SortedSet categories) {
+
+ }
+
+ public SortedSet getQaWizardCategories() {
+ return qaWizardCategories;
+ }
+
+ public void setQaWizardCategories(SortedSet qaWizardCategories) {
+ this.qaWizardCategories = qaWizardCategories;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/ReflectionDTO.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/ReflectionDTO.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dto/ReflectionDTO.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,134 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.dto;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * DTO that holds reflections from users
+ *
+ *
+ * @author Ozgur Demirtas
+ */
+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 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;
+ }
+
+ /**
+ * @param entry
+ * The entry to set.
+ */
+ public void setEntry(String entry) {
+ this.entry = entry;
+ }
+
+ /**
+ * @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 reflectionUid.
+ */
+ public String getReflectionUid() {
+ return reflectionUid;
+ }
+
+ /**
+ * @param reflectionUid
+ * The reflectionUid to set.
+ */
+ public void setReflectionUid(String reflectionUid) {
+ this.reflectionUid = reflectionUid;
+ }
+
+ /**
+ * @return Returns the userId.
+ */
+ public String getUserId() {
+ return userId;
+ }
+
+ /**
+ * @param userId
+ * The userId to set.
+ */
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ /**
+ * @return Returns the userName.
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @param userName
+ * The userName to set.
+ */
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml (.../qaApplicationContext.xml) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml (.../qaApplicationContext.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -41,7 +41,7 @@
-
+
@@ -80,7 +80,7 @@
-
+
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -33,18 +33,17 @@
import org.lamsfoundation.lams.tool.IToolVO;
import org.lamsfoundation.lams.tool.exception.DataMissingException;
import org.lamsfoundation.lams.tool.exception.ToolException;
-import org.lamsfoundation.lams.tool.qa.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.QaCondition;
import org.lamsfoundation.lams.tool.qa.QaConfigItem;
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.QaQuestion;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUploadedFile;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
import org.lamsfoundation.lams.tool.qa.QaWizardCategory;
import org.lamsfoundation.lams.tool.qa.dto.AverageRatingDTO;
-import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.tool.qa.util.QaApplicationException;
import org.lamsfoundation.lams.util.audit.IAuditService;
/**
@@ -61,66 +60,49 @@
* @return the qa object
*/
- public QaContent retrieveQa(long toolContentId) throws QaApplicationException;
+ public QaContent getQa(long toolContentId) throws QaApplicationException;
- /**
- * Return the qa object according to the requested content id.
- *
- * @param toolContentId
- * the tool content id
- * @return the qa object or null
- */
-
- public QaContent loadQa(long toolContentId) throws QaApplicationException;
-
public void saveOrUpdateQa(QaContent qa) throws QaApplicationException;
- public QaContent getQaContentByUID(Long uid) throws QaApplicationException;
-
public int getTotalNumberOfUsers(QaContent qa) throws QaApplicationException;
public int countSessionComplete(QaContent qa) throws QaApplicationException;
- public int countSessionComplete() throws QaApplicationException;
-
public void updateQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException;
+ public QaQueUsr loadQaQueUsr(Long userId) throws QaApplicationException;
+
+ public QaUsrResp getResponseByUserAndQuestion(final Long queUsrId, final Long qaQueContentId)
+ throws QaApplicationException;
+
/**
- * Return the question content object according to the requested question
- * content id.
+ * Creates or updates response with answer submitted by user.
*
- * @param qaQueContentId
- * qa question content id
- * @return the qa question object
+ * @param newAnswer
+ * @param toolSessionID
+ * @param questionDisplayOrder
*/
- public QaQueContent retrieveQaQue(long qaQueContentId) throws QaApplicationException;
+ void updateResponseWithNewAnswer(String newAnswer, String toolSessionID, Long questionDisplayOrder);
- public QaQueUsr loadQaQueUsr(Long userId) throws QaApplicationException;
+ public void createQaQue(QaQuestion qaQuestion) throws QaApplicationException;
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId)
- throws QaApplicationException;
+ public void removeQaQueContent(QaQuestion qaQuestion) throws QaApplicationException;
- public void createQaQue(QaQueContent qaQueContent) throws QaApplicationException;
-
- public void removeQaQueContent(QaQueContent qaQueContent) throws QaApplicationException;
-
public void createQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException;
public void updateUserResponse(QaUsrResp resp) throws QaApplicationException;
- public QaUsrResp retrieveQaUsrResp(long responseId) throws QaApplicationException;
+ public QaUsrResp getResponseById(Long responseId) throws QaApplicationException;
- public void updateQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException;
-
- public QaQueContent getQuestionContentByQuestionText(final String question, Long contentUid)
+ public QaQuestion getQuestionContentByQuestionText(final String question, Long contentUid)
throws QaApplicationException;
- public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long contentUid)
+ public QaQuestion getQuestionByContentAndDisplayOrder(Long displayOrder, Long contentUid)
throws QaApplicationException;
public List getAllQuestionEntriesSorted(final long qaContentId) throws QaApplicationException;
- public void saveOrUpdateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException;
+ public void saveOrUpdateQaQueContent(QaQuestion qaQuestion) throws QaApplicationException;
/**
* Return the qa session object according to the requested session id.
@@ -131,65 +113,38 @@
*/
public QaSession retrieveQaSession(long qaSessionId) throws QaApplicationException;
- public QaSession retrieveQaSessionOrNullById(long qaSessionId) throws QaApplicationException;
+ public QaSession getSessionById(long qaSessionId) throws QaApplicationException;
public void createQaSession(QaSession qaSession) throws QaApplicationException;
public List getSessionNamesFromContent(QaContent qaContent) throws QaApplicationException;
- public String getSessionNameById(long qaSessionId) throws QaApplicationException;
-
public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException;
public List getSessionsFromContent(QaContent qaContent) throws QaApplicationException;
- public void createQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException;
+ public QaQueUsr createUser(Long toolSessionID) throws QaApplicationException;
public void updateQaSession(QaSession qaSession) throws QaApplicationException;
- /**
- * Return the qa que user object according to the requested usr id.
- *
- * @param qaQaUsrId
- * qa usr id
- * @return the qa que usr object
- */
- public QaQueUsr retrieveQaQueUsr(long qaQaUsrId) throws QaApplicationException;
-
public QaQueUsr getQaQueUsrById(long qaQueUsrId) throws QaApplicationException;
public void updateQa(QaContent qa) throws QaApplicationException;
public void createQa(QaContent qa) throws QaApplicationException;
- public QaUsrResp getAttemptByUID(Long uid) throws QaApplicationException;
-
- public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId);
-
public void hideResponse(QaUsrResp qaUsrResp) throws QaApplicationException;
public void showResponse(QaUsrResp qaUsrResp) throws QaApplicationException;
- public void deleteQa(QaContent qa) throws QaApplicationException;
-
- public void deleteQaSession(QaSession QaSession) throws QaApplicationException;
-
public QaContent retrieveQaBySession(long qaSessionId) throws QaApplicationException;
- public void deleteUsrRespByQueId(Long qaQueId) throws QaApplicationException;
+ public QaQueUsr getUserByIdAndSession(final Long queUsrId, final Long qaSessionId) throws QaApplicationException;
- public void deleteQaById(Long qaId) throws QaApplicationException;
-
- public QaQueUsr getQaUserBySession(final Long queUsrId, final Long qaSessionId) throws QaApplicationException;
-
- public void deleteQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException;
-
public void removeUserResponse(QaUsrResp resp) throws QaApplicationException;
public List getAllQuestionEntries(final Long uid) throws QaApplicationException;
- public User getCurrentUserData(String username) throws QaApplicationException;
-
public List getUserBySessionOnly(final QaSession qaSession) throws QaApplicationException;
/**
@@ -204,22 +159,9 @@
public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException;
- public void setAsForceComplete(Long userId) throws QaApplicationException;
+ public boolean isStudentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException;
- public void setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException;
-
- public boolean studentActivityOccurred(QaContent qa) throws QaApplicationException;
-
- public boolean studentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException;
-
/**
- * removeToolContent(Long toolContentId) return void
- *
- * @param toolContentId
- */
- public void removeToolContent(Long toolContentId) throws QaApplicationException;
-
- /**
* createToolSession(Long toolSessionId,String toolSessionName, Long
* toolContentId)
*
@@ -246,14 +188,6 @@
public long getToolDefaultContentIdBySignature(String toolSignature) throws QaApplicationException;
- public int countSessionUser(QaSession qaSession) throws QaApplicationException;
-
- public List getToolSessionsForContent(QaContent qa) throws QaApplicationException;
-
- public QaQueContent getToolDefaultQuestionContent(long contentId) throws QaApplicationException;
-
- public void configureContentRepository() throws QaApplicationException;
-
public ITicket getRepositoryLoginTicket() throws QaApplicationException;
public void deleteFromRepository(Long uuid, Long versionID) throws QaApplicationException;
@@ -269,8 +203,6 @@
public List retrieveQaUploadedFiles(QaContent qa) throws QaApplicationException;
- public List retrieveQaQueContentsByToolContentId(long toolContentId);
-
public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry);
public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java
===================================================================
diff -u -r1fe9e94dac88b45fa49d41d4290dccc9211a78a6 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java (.../QaImportContentVersionFilter.java) (revision 1fe9e94dac88b45fa49d41d4290dccc9211a78a6)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaImportContentVersionFilter.java (.../QaImportContentVersionFilter.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,7 +24,7 @@
import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter;
import org.lamsfoundation.lams.tool.qa.QaContent;
-import org.lamsfoundation.lams.tool.qa.QaQueContent;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
/**
* Import filter class for different versions of Q&A content.
@@ -42,7 +42,7 @@
}
public void up20081126To20101022() {
- this.removeField(QaQueContent.class, "isOptional");
- this.addField(QaQueContent.class, "required", new Boolean(false));
+ this.removeField(QaQuestion.class, "isOptional");
+ this.addField(QaQuestion.class, "required", new Boolean(false));
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java
===================================================================
diff -u -r37b49e5e78d2b57936d98e68f6057539472b7725 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java (.../QaOutputFactory.java) (revision 37b49e5e78d2b57936d98e68f6057539472b7725)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaOutputFactory.java (.../QaOutputFactory.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -41,8 +41,8 @@
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaCondition;
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.QaQuestion;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
@@ -75,7 +75,7 @@
// adding all existing conditions
userAnswersDefinition.setDefaultConditions(new ArrayList(qaContent.getConditions()));
// if no conditions were created in the tool instance, a default condition is added;
- if (userAnswersDefinition.getDefaultConditions().isEmpty() && !qaContent.getQaQueContents().isEmpty()) {
+ if (userAnswersDefinition.getDefaultConditions().isEmpty() && !qaContent.getQaQuestions().isEmpty()) {
QaCondition defaultCondition = createDefaultComplexUserAnswersCondition(qaContent);
qaContent.getConditions().add(defaultCondition);
@@ -156,27 +156,22 @@
QaSession session = qaService.retrieveQaSession(toolSessionId);
QaContent qaContent = session.getQaContent();
- Set questions = qaContent.getQaQueContents();
+ Set questions = qaContent.getQaQuestions();
String[] answers = new String[questions.size()];
- QaQueUsr user = qaService.getQaUserBySession(learnerId, session.getUid());
- for (QaQueContent question : questions) {
- List attempts = null;
- if (user != null) {
- attempts = qaService.getAttemptsForUserAndQuestionContent(user.getUid(), question.getUid());
+ QaQueUsr user = qaService.getUserByIdAndSession(learnerId, session.getQaSessionId());
+ for (QaQuestion question : questions) {
+ QaUsrResp response = qaService.getResponseByUserAndQuestion(user.getQueUsrId(), question.getUid());
+ if (response != null) {
+ answers[question.getDisplayOrder() - 1] = response.getAnswer();
}
- if (attempts != null && !attempts.isEmpty()) {
- // only the last attempt is taken into consideration
- String answer = attempts.get(attempts.size() - 1).getAnswer();
- answers[question.getDisplayOrder() - 1] = answer;
- }
}
return new ToolOutput(name, getI18NText(QaAppConstants.USER_ANSWERS_DEFINITION_NAME, true), answers, false);
} else if (QaAppConstants.GROUP_ANSWERS_DEFINITION_NAME.equals(nameParts[0])) {
// all users' answers are loaded from the DB and array of strings is created
QaSession session = qaService.retrieveQaSession(toolSessionId);
QaContent qaContent = session.getQaContent();
- Set questions = qaContent.getQaQueContents();
+ Set questions = qaContent.getQaQuestions();
Set users = session.getQaQueUsers();
String[] dummyStringArray = new String[] {};
@@ -186,22 +181,19 @@
if (user != null) {
List answers = new LinkedList();
long lastAttemptTime = Long.MAX_VALUE;
- for (QaQueContent question : questions) {
+ for (QaQuestion question : questions) {
- List attempts = qaService.getAttemptsForUserAndQuestionContent(user.getUid(),
- question.getUid());
+ QaUsrResp response = qaService.getResponseByUserAndQuestion(user.getQueUsrId(), question.getUid());
- if (attempts != null && !attempts.isEmpty()) {
- // only the last attempt is taken into consideration
- QaUsrResp attempt = attempts.get(attempts.size() - 1);
+ if (response != null) {
// we get the time of the attempt - the "lastAttemptTime" will the time of the whole answer
// set given
- long timeOfAttempt = attempt.getAttemptTime().getTime();
+ long timeOfAttempt = response.getAttemptTime().getTime();
if (timeOfAttempt < lastAttemptTime) {
lastAttemptTime = timeOfAttempt;
}
- String answer = attempt.getAnswer();
+ String answer = response.getAnswer();
if (!StringUtils.isBlank(answer)) {
// check for duplicate answers
boolean duplicate = false;
@@ -242,10 +234,10 @@
// Questions asked in this Q&A activity
QaSession session = qaService.retrieveQaSession(toolSessionId);
QaContent qaContent = session.getQaContent();
- Set questions = qaContent.getQaQueContents();
+ Set questions = qaContent.getQaQuestions();
String[] questionArray = new String[questions.size()];
int questionIndex = 0;
- for (QaQueContent question : questions) {
+ for (QaQuestion question : questions) {
questionArray[questionIndex++] = question.getQuestion();
}
return new ToolOutput(name, getI18NText(QaAppConstants.QUESTIONS_DEFINITION_NAME, true), questionArray,
@@ -271,11 +263,11 @@
* @return default Q&A condition
*/
protected QaCondition createDefaultComplexUserAnswersCondition(QaContent qaContent) {
- if (qaContent.getQaQueContents().isEmpty()) {
+ if (qaContent.getQaQuestions().isEmpty()) {
return null;
}
- Set questions = new HashSet();
- questions.add((QaQueContent) qaContent.getQaQueContents().iterator().next());
+ Set questions = new HashSet();
+ questions.add((QaQuestion) qaContent.getQaQuestions().iterator().next());
String name = buildConditionName(QaAppConstants.USER_ANSWERS_DEFINITION_NAME, qaContent.getQaContentId()
.toString());
// Default condition checks if the first answer contains word "LAMS"
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -36,13 +36,14 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import javax.servlet.http.HttpSession;
+
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.contentrepository.AccessDeniedException;
import org.lamsfoundation.lams.contentrepository.FileException;
import org.lamsfoundation.lams.contentrepository.ICredentials;
import org.lamsfoundation.lams.contentrepository.ITicket;
import org.lamsfoundation.lams.contentrepository.IVersionedNode;
-import org.lamsfoundation.lams.contentrepository.ItemExistsException;
import org.lamsfoundation.lams.contentrepository.ItemNotFoundException;
import org.lamsfoundation.lams.contentrepository.LoginException;
import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException;
@@ -67,35 +68,36 @@
import org.lamsfoundation.lams.tool.exception.SessionDataExistsException;
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
-import org.lamsfoundation.lams.tool.qa.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.QaCondition;
import org.lamsfoundation.lams.tool.qa.QaConfigItem;
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.QaQuestion;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUploadedFile;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
import org.lamsfoundation.lams.tool.qa.QaWizardCategory;
import org.lamsfoundation.lams.tool.qa.ResponseRating;
import org.lamsfoundation.lams.tool.qa.dao.IQaConfigItemDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaContentDAO;
-import org.lamsfoundation.lams.tool.qa.dao.IQaQueContentDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaQueUsrDAO;
+import org.lamsfoundation.lams.tool.qa.dao.IQaQuestionDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaSessionDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaUploadedFileDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO;
import org.lamsfoundation.lams.tool.qa.dao.IQaWizardDAO;
import org.lamsfoundation.lams.tool.qa.dao.IResponseRatingDAO;
import org.lamsfoundation.lams.tool.qa.dto.AverageRatingDTO;
+import org.lamsfoundation.lams.tool.qa.util.QaApplicationException;
import org.lamsfoundation.lams.tool.service.ILamsToolService;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.usermanagement.service.IUserManagementService;
import org.lamsfoundation.lams.util.WebUtil;
import org.lamsfoundation.lams.util.audit.IAuditService;
import org.lamsfoundation.lams.util.wddx.WDDXProcessor;
import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
import org.springframework.dao.DataAccessException;
/**
@@ -114,9 +116,7 @@
*/
public class QaServicePOJO implements IQaService, ToolContentManager, ToolSessionManager, ToolContentImport102Manager,
- QaAppConstants
-
-{
+ QaAppConstants {
static Logger logger = Logger.getLogger(QaServicePOJO.class.getName());
private final String repositoryUser = "laqa11";
@@ -126,7 +126,7 @@
private ICredentials cred;
private IQaContentDAO qaDAO;
- private IQaQueContentDAO qaQueContentDAO;
+ private IQaQuestionDAO qaQuestionDAO;
private IQaSessionDAO qaSessionDAO;
private IQaQueUsrDAO qaQueUsrDAO;
@@ -148,26 +148,6 @@
private Random generator = new Random();
- public void configureContentRepository() throws QaApplicationException {
- cred = new SimpleCredentials(repositoryUser, repositoryId);
- QaServicePOJO.logger.debug("retrieved cred: " + cred);
- try {
- repositoryService.createCredentials(cred);
- repositoryService.addWorkspace(cred, repositoryWorkspace);
- } catch (ItemExistsException ie) {
- QaServicePOJO.logger.warn("Tried to configure repository but it "
- + " appears to be already configured. Exception thrown by repository being ignored. ", ie);
- } catch (RepositoryCheckedException e) {
- String error = "Error occured while trying to configure repository." + " Unable to recover from error: "
- + e.getMessage();
- QaServicePOJO.logger.error(error, e);
- throw new QaApplicationException(error, e);
- }
- }
-
- public QaServicePOJO() {
- }
-
public void createQa(QaContent qaContent) throws QaApplicationException {
try {
qaDAO.saveQa(qaContent);
@@ -176,20 +156,10 @@
}
}
- public QaContent getQaContentByUID(Long uid) throws QaApplicationException {
+ public QaContent getQa(long toolContentID) throws QaApplicationException {
try {
- return qaDAO.getQaContentByUID(uid);
+ return qaDAO.getQaByContentId(toolContentID);
} catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is getting qa content by uid: "
- + e.getMessage(), e);
- }
-
- }
-
- public QaContent retrieveQa(long toolContentID) throws QaApplicationException {
- try {
- return qaDAO.getQaById(toolContentID);
- } catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is loading qa content: " + e.getMessage(), e);
}
}
@@ -204,42 +174,31 @@
}
- /**
- * returns null if not found
- */
- public QaContent loadQa(long toolContentID) throws QaApplicationException {
- try {
- return qaDAO.loadQaById(toolContentID);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is loading qa content: " + e.getMessage(), e);
- }
- }
-
- public QaQueContent getQuestionContentByQuestionText(final String question, Long contentUid)
+ public QaQuestion getQuestionContentByQuestionText(final String question, Long contentUid)
throws QaApplicationException {
try {
- return qaQueContentDAO.getQuestionContentByQuestionText(question, contentUid);
+ return qaQuestionDAO.getQuestionContentByQuestionText(question, contentUid);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is getting qa content by question text: "
+ e.getMessage(), e);
}
}
- public QaQueContent getQuestionContentByDisplayOrder(Long displayOrder, Long contentUid)
+ public QaQuestion getQuestionByContentAndDisplayOrder(Long displayOrder, Long contentUid)
throws QaApplicationException {
try {
- return qaQueContentDAO.getQuestionContentByDisplayOrder(displayOrder, contentUid);
+ return qaQuestionDAO.getQuestionByDisplayOrder(displayOrder, contentUid);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is getting qa content by question text: "
+ e.getMessage(), e);
}
}
- public void saveOrUpdateQaQueContent(QaQueContent qaQueContent) throws QaApplicationException {
+ public void saveOrUpdateQaQueContent(QaQuestion qaQuestion) throws QaApplicationException {
try {
- qaQueContentDAO.saveOrUpdateQaQueContent(qaQueContent);
+ qaQuestionDAO.saveOrUpdateQaQueContent(qaQuestion);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is updating qa content by question: "
@@ -248,9 +207,9 @@
}
- public void createQaQue(QaQueContent qaQueContent) throws QaApplicationException {
+ public void createQaQue(QaQuestion qaQuestion) throws QaApplicationException {
try {
- qaQueContentDAO.createQueContent(qaQueContent);
+ qaQuestionDAO.createQueContent(qaQuestion);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is creating qa content: " + e.getMessage(), e);
}
@@ -273,15 +232,6 @@
}
}
- public String getSessionNameById(long qaSessionId) throws QaApplicationException {
- try {
- return qaSessionDAO.getSessionNameById(qaSessionId);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is getting session name: " + e.getMessage(),
- e);
- }
- }
-
public List getSessionsFromContent(QaContent qaContent) throws QaApplicationException {
try {
return qaSessionDAO.getSessionsFromContent(qaContent);
@@ -291,15 +241,25 @@
}
}
- public void createQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException {
+ public QaQueUsr createUser(Long toolSessionID) throws QaApplicationException {
try {
- qaQueUsrDAO.createUsr(qaQueUsr);
+ HttpSession ss = SessionManager.getSession();
+ UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userId = toolUser.getUserID().longValue();
+ String userName = toolUser.getLogin();
+ String fullName = toolUser.getFirstName() + " " + toolUser.getLastName();
+ QaSession qaSession = getSessionById(toolSessionID.longValue());
+
+ QaQueUsr user = new QaQueUsr(userId, userName, fullName, qaSession, new TreeSet());
+ qaQueUsrDAO.createUsr(user);
+
+ return user;
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is creating qa QueUsr: " + e.getMessage(), e);
}
}
- public QaQueUsr getQaUserBySession(final Long queUsrId, final Long qaSessionId) throws QaApplicationException {
+ public QaQueUsr getUserByIdAndSession(final Long queUsrId, final Long qaSessionId) throws QaApplicationException {
try {
return qaQueUsrDAO.getQaUserBySession(queUsrId, qaSessionId);
} catch (DataAccessException e) {
@@ -325,42 +285,54 @@
}
}
- public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId)
+ public QaUsrResp getResponseByUserAndQuestion(final Long queUsrId, final Long qaQueContentId)
throws QaApplicationException {
try {
- return qaUsrRespDAO.getAttemptsForUserAndQuestionContent(queUsrId, qaQueContentId);
+ return qaUsrRespDAO.getResponseByUserAndQuestion(queUsrId, qaQueContentId);
} catch (DataAccessException e) {
throw new QaApplicationException(
"Exception occured when lams is getting qa qaUsrRespDAO by user id and que content id: "
+ e.getMessage(), e);
}
}
- public QaUsrResp getAttemptByUID(Long uid) throws QaApplicationException {
+ public void updateUserResponse(QaUsrResp resp) throws QaApplicationException {
try {
- return qaUsrRespDAO.getAttemptByUID(uid);
+ qaUsrRespDAO.updateUserResponse(resp);
} catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is getting response by uid: "
- + e.getMessage(), e);
+ throw new QaApplicationException("Exception occured when lams is updating response" + e.getMessage(), e);
}
}
+
+ public void updateResponseWithNewAnswer(String newAnswer, String toolSessionID, Long questionDisplayOrder) {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userId = new Long(toolUser.getUserID().longValue());
+ QaQueUsr user = getUserByIdAndSession(userId, new Long(toolSessionID));
- public void removeAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId)
- throws QaApplicationException {
- try {
- qaUsrRespDAO.removeAttemptsForUserAndQuestionContent(queUsrId, qaQueContentId);
- } catch (DataAccessException e) {
- throw new QaApplicationException(
- "Exception occured when lams is removing attempts by queUsrId and qaQueContentId: "
- + e.getMessage(), e);
+ QaSession session = getSessionById(new Long(toolSessionID));
+ QaContent qaContent = session.getQaContent();
+ //set content in use
+ if (!qaContent.isContentLocked()) {
+ qaContent.setContentLocked(true);
+ updateQa(qaContent);
}
- }
+
+ QaQuestion question = getQuestionByContentAndDisplayOrder(new Long(questionDisplayOrder),
+ qaContent.getUid());
- public void updateUserResponse(QaUsrResp resp) throws QaApplicationException {
- try {
- qaUsrRespDAO.updateUserResponse(resp);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is updating response" + e.getMessage(), e);
+ QaUsrResp response = getResponseByUserAndQuestion(user.getQueUsrId(), question.getUid());
+ // if response doesn't exist
+ if (response == null) {
+ response = new QaUsrResp(newAnswer, new Date(System.currentTimeMillis()), "", question, user, true);
+ createQaUsrResp(response);
+
+ // if answer has changed
+ } else if (!newAnswer.equals(response.getAnswer())) {
+ response.setAnswer(newAnswer);
+ response.setAttemptTime(new Date(System.currentTimeMillis()));
+ response.setTimezone("");
+ updateUserResponse(response);
}
}
@@ -389,25 +361,15 @@
}
}
- public QaUsrResp retrieveQaUsrResp(long responseId) throws QaApplicationException {
+ public QaUsrResp getResponseById(Long responseId) throws QaApplicationException {
try {
- QaUsrResp qaUsrResp = qaUsrRespDAO.retrieveQaUsrResp(responseId);
- return qaUsrResp;
+ return qaUsrRespDAO.getResponseById(responseId);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is loading qa qaUsrResp: " + e.getMessage(),
e);
}
-
}
- public void updateQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException {
- try {
- qaUsrRespDAO.updateUserResponse(qaUsrResp);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is updating qa UsrResp: " + e.getMessage(), e);
- }
- }
-
public int countSessionComplete(QaContent qa) throws QaApplicationException {
try {
return qaSessionDAO.countSessionComplete(qa);
@@ -417,24 +379,6 @@
}
}
- public int countSessionComplete() throws QaApplicationException {
- try {
- return qaSessionDAO.countSessionComplete();
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is counting complete sessions"
- + e.getMessage(), e);
- }
- }
-
- public QaQueContent retrieveQaQue(long qaQueContentId) throws QaApplicationException {
- try {
- return qaQueContentDAO.getQaQueById(qaQueContentId);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is loading qa question content: "
- + e.getMessage(), e);
- }
- }
-
public QaSession retrieveQaSession(long qaSessionId) throws QaApplicationException {
try {
return qaSessionDAO.getQaSessionById(qaSessionId);
@@ -443,9 +387,9 @@
}
}
- public QaSession retrieveQaSessionOrNullById(long qaSessionId) throws QaApplicationException {
+ public QaSession getSessionById(long qaSessionId) throws QaApplicationException {
try {
- return qaSessionDAO.getQaSessionOrNullById(qaSessionId);
+ return qaSessionDAO.getQaSessionById(qaSessionId);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is loading qa session : " + e.getMessage(), e);
}
@@ -459,14 +403,6 @@
}
}
- public List retrieveQaQueContentsByToolContentId(long qaContentId) throws QaApplicationException {
- try {
- return qaQueContentDAO.getQaQueContentsByContentId(qaContentId);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is loading qa que usr: " + e.getMessage(), e);
- }
- }
-
public void updateQa(QaContent qa) throws QaApplicationException {
try {
qaDAO.updateQa(qa);
@@ -485,33 +421,6 @@
}
}
- public void deleteQa(QaContent qa) throws QaApplicationException {
- try {
- qaDAO.deleteQa(qa);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is deleting" + " the qa content: "
- + e.getMessage(), e);
- }
- }
-
- public void deleteQaById(Long qaId) throws QaApplicationException {
- try {
- qaDAO.removeQaById(qaId);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is deleting" + " the qa content: "
- + e.getMessage(), e);
- }
- }
-
- public void deleteQaSession(QaSession QaSession) throws QaApplicationException {
- try {
- qaSessionDAO.deleteQaSession(QaSession);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is deleting" + " the qa session: "
- + e.getMessage(), e);
- }
- }
-
public void removeUserResponse(QaUsrResp resp) throws QaApplicationException {
try {
auditService.logChange(QaAppConstants.MY_SIGNATURE, resp.getQaQueUser().getQueUsrId(), resp.getQaQueUser()
@@ -527,36 +436,18 @@
* logs hiding of a user entered vote
*/
public void hideResponse(QaUsrResp qaUsrResp) throws QaApplicationException {
- auditService.logHideEntry(QaAppConstants.MY_SIGNATURE, qaUsrResp.getQueUsrId(), qaUsrResp.getQaQueUser()
+ auditService.logHideEntry(QaAppConstants.MY_SIGNATURE, qaUsrResp.getQaQueUser().getQueUsrId(), qaUsrResp.getQaQueUser()
.getUsername(), qaUsrResp.getAnswer());
}
/**
* logs showing of a user entered vote
*/
public void showResponse(QaUsrResp qaUsrResp) throws QaApplicationException {
- auditService.logShowEntry(QaAppConstants.MY_SIGNATURE, qaUsrResp.getQueUsrId(), qaUsrResp.getQaQueUser()
+ auditService.logShowEntry(QaAppConstants.MY_SIGNATURE, qaUsrResp.getQaQueUser().getQueUsrId(), qaUsrResp.getQaQueUser()
.getUsername(), qaUsrResp.getAnswer());
}
- public void deleteUsrRespByQueId(Long qaQueId) throws QaApplicationException {
- try {
- qaUsrRespDAO.removeUserResponseByQaQueId(qaQueId);
- } catch (DataAccessException e) {
- throw new QaApplicationException(
- "Exception occured when lams is deleting" + " the resp: " + e.getMessage(), e);
- }
- }
-
- public void deleteQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException {
- try {
- qaQueUsrDAO.deleteQaQueUsr(qaQueUsr);
- } catch (DataAccessException e) {
- throw new QaApplicationException(
- "Exception occured when lams is deleting" + " the user: " + e.getMessage(), e);
- }
- }
-
public List retrieveQaUploadedFiles(QaContent qa) throws QaApplicationException {
try {
return qaUploadedFileDAO.retrieveQaUploadedFiles(qa);
@@ -575,153 +466,60 @@
}
}
- public int countTotalNumberOfUserResponsed(QaContent qa) throws QaApplicationException {
- try {
- return qaDAO.countUserResponsed(qa);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured in [countTotalNumberOfUserResponsed]: "
- + e.getMessage(), e);
- }
- }
-
public List getAllQuestionEntries(final Long uid) throws QaApplicationException {
try {
- return qaQueContentDAO.getAllQuestionEntries(uid.longValue());
+ return qaQuestionDAO.getAllQuestionEntries(uid.longValue());
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is getting by uid qa question content: "
+ e.getMessage(), e);
}
}
- public List getAllQuestionEntriesSorted(final long qaContentId) throws QaApplicationException {
+ public List getAllQuestionEntriesSorted(final long contentUid) throws QaApplicationException {
try {
- return qaQueContentDAO.getAllQuestionEntriesSorted(qaContentId);
+ return qaQuestionDAO.getAllQuestionEntriesSorted(contentUid);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is getting all question entries: "
+ e.getMessage(), e);
}
}
- public void removeQaQueContent(QaQueContent qaQueContent) throws QaApplicationException {
+ public void removeQaQueContent(QaQuestion qaQuestion) throws QaApplicationException {
try {
- qaQueContentDAO.removeQaQueContent(qaQueContent);
+ qaQuestionDAO.removeQaQueContent(qaQuestion);
} catch (DataAccessException e) {
throw new QaApplicationException("Exception occured when lams is removing question content: "
+ e.getMessage(), e);
}
}
- public User getCurrentUserData(String username) throws QaApplicationException {
- try {
- QaServicePOJO.logger.debug("getCurrentUserData: " + username);
- /*
- * this will return null if the username not found
- */
- User user = userManagementService.getUserByLogin(username);
- if (user == null) {
- QaServicePOJO.logger.debug("No user with the username: " + username + " exists.");
- throw new QaApplicationException("No user with that username exists.");
- }
- return user;
- } catch (DataAccessException e) {
- throw new QaApplicationException("Unable to find current user information" + " Root Cause: ["
- + e.getMessage() + "]", e);
- }
- }
-
- public void saveQaContent(QaContent qa) throws QaApplicationException {
- try {
- qaDAO.saveQa(qa);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is saving" + " the qa content: "
- + e.getMessage(), e);
- }
- }
-
- public QaQueUsr retrieveQaQueUsr(long qaQaQueUsrId) throws QaApplicationException {
- try {
- return qaQueUsrDAO.getQaQueUsrById(qaQaQueUsrId);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is loading qa que usr: " + e.getMessage(), e);
- }
- }
-
- public int countSessionUser(QaSession qaSession) throws QaApplicationException {
- try {
- return qaQueUsrDAO.countSessionUser(qaSession);
- } catch (DataAccessException e) {
- throw new QaApplicationException("Exception occured when lams is counting users in the session "
- + e.getMessage(), e);
- }
- }
-
/**
- * checks the paramter content in the user responses table boolean studentActivityOccurredGlobal(QaContent
- * qaContent) throws QaApplicationException
+ * checks the paramter content in the user responses table
*
* @param qa
* @return boolean
* @throws QaApplicationException
*/
- public boolean studentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException {
+ public boolean isStudentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException {
+ int countResponses = 0;
if (qaContent != null) {
- Iterator questionIterator = qaContent.getQaQueContents().iterator();
- while (questionIterator.hasNext()) {
- QaQueContent qaQueContent = (QaQueContent) questionIterator.next();
- Iterator responsesIterator = qaQueContent.getQaUsrResps().iterator();
- while (responsesIterator.hasNext()) {
- return true;
- }
- }
+ countResponses = qaUsrRespDAO.getCountResponsesByQaContent(qaContent.getQaContentId());
}
- return false;
+ return countResponses > 0;
}
/**
- * counts the number of sessions marked INCOMPLETE for a content int countIncompleteSession(QaContent qa) throws
- * QaApplicationException
+ * gets called ONLY when a lesson is being created in monitoring mode.
+ * Should create the new content(toContent) based on what the author has
+ * created her content with. In q/a tool's case that is content + question's
+ * content but not user responses. The deep copy should go only as far as
+ * default content (or author created content) already goes.
+ * ToolContentManager CONTRACT
*
- * @param qa
- * @return int
- * @throws QaApplicationException
- */
- public int countIncompleteSession(QaContent qa) throws QaApplicationException {
- QaServicePOJO.logger.debug("qaContentId: " + qa.getQaContentId());
- int countIncompleteSession = qaSessionDAO.countSessionIncomplete();
- QaServicePOJO.logger.debug("countIncompleteSession: " + countIncompleteSession);
- return countIncompleteSession;
- }
-
- /**
- * checks the parameter content in the tool sessions table. find out if any student has ever used (logged in through
- * the url and replied) to this content return true even if you have only one content passed as parameter referenced
- * in the tool sessions table
+ * similar to public void removeToolContent(Long toolContentID) gets called
+ * by Container+Flash
*
- * boolean studentActivityOccurred(QaContent qa) throws QaApplicationException
- *
- * @param qa
- * @return boolean
- * @throws QaApplicationException
*/
- public boolean studentActivityOccurred(QaContent qa) throws QaApplicationException {
- QaServicePOJO.logger.debug("qaContentId: " + qa.getQaContentId());
- int countStudentActivity = qaSessionDAO.studentActivityOccurred(qa);
- QaServicePOJO.logger.debug("countIncompleteSession: " + countStudentActivity);
- if (countStudentActivity > 0) {
- return true;
- }
- return false;
- }
-
- /**
- * gets called ONLY when a lesson is being created in monitoring mode. Should create the new content(toContent)
- * based on what the author has created her content with. In q/a tool's case that is content + question's content
- * but not user responses. The deep copy should go only as far as default content (or author created content)
- * already goes. ToolContentManager CONTRACT
- *
- * similar to public void removeToolContent(Long toolContentID) gets called by Container+Flash
- *
- */
public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException
{
@@ -750,7 +548,7 @@
QaServicePOJO.logger.debug("final - copyToolContent using ids: " + fromContentId + " and " + toContentId);
try {
- QaContent fromContent = qaDAO.loadQaById(fromContentId.longValue());
+ QaContent fromContent = qaDAO.getQaByContentId(fromContentId.longValue());
if (fromContent == null) {
QaServicePOJO.logger.debug("fromContent is null.");
@@ -766,7 +564,7 @@
+ QaAppConstants.MY_SIGNATURE + " Can't continue!");
}
- fromContent = qaDAO.loadQaById(fromContentId.longValue());
+ fromContent = qaDAO.getQaByContentId(fromContentId.longValue());
}
if (fromContentId.equals(defaultContentId) && fromContent != null && fromContent.getConditions().isEmpty()) {
fromContent.getConditions().add(
@@ -793,65 +591,9 @@
}
/**
- * setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException update the tool session status to
- * COMPLETE for this tool session
+ * setAsDefineLater(Long toolContentID) throws DataMissingException,
+ * ToolException
*
- * @param Long
- * toolSessionId
- */
- public void setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException {
- QaServicePOJO.logger
- .debug("Request for setAsForceCompleteSession has come for toolSessionId: " + toolSessionId);
-
- QaSession qaSession = retrieveQaSessionOrNullById(toolSessionId.longValue());
- qaSession.setSession_status(QaSession.COMPLETED);
- updateQaSession(qaSession);
- QaServicePOJO.logger.debug("updated qaSession to COMPLETED : ");
- }
-
- /**
- * setAsForceComplete(Long userId) throws QaApplicationException update the tool session status to COMPLETE for this
- * user
- *
- * @param userId
- */
- public void setAsForceComplete(Long userId) throws QaApplicationException {
- QaServicePOJO.logger.debug("request for setAsForceComplete has come for userId: " + userId);
- QaQueUsr qaQueUsr = loadQaQueUsr(userId);
-
- if (qaQueUsr != null) {
- QaSession qaSession = qaQueUsr.getQaSession();
- if (qaSession != null) {
- Long usersToolSessionId = qaSession.getQaSessionId();
- QaServicePOJO.logger.debug("retrieved tool session has tool session id : " + usersToolSessionId);
-
- qaSession = retrieveQaSessionOrNullById(usersToolSessionId.longValue());
- qaSession.setSession_status(QaSession.COMPLETED);
- updateQaSession(qaSession);
- QaServicePOJO.logger.debug("updated qaSession to COMPLETED");
- QaContent qaContent = qaSession.getQaContent();
- QaServicePOJO.logger.debug("qaSession uses qaContentId : " + qaContent.getQaContentId());
-
- int countIncompleteSession = countIncompleteSession(qaContent);
- QaServicePOJO.logger.debug("qaSession countIncompleteSession : " + countIncompleteSession);
-
- if (countIncompleteSession == 0) {
- qaContent.setContentLocked(false);
- updateQa(qaContent);
- }
- } else {
- QaServicePOJO.logger.debug("WARNING!: retrieved qaSession is null.");
- throw new QaApplicationException("Fail to setAsForceComplete" + " based on null qaSession.");
- }
- } else {
- QaServicePOJO.logger.debug("WARNING!: retrieved qaQueUsr is null.");
- throw new QaApplicationException("Fail to setAsForceComplete" + " based on null qaQueUsr.");
- }
- }
-
- /**
- * setAsDefineLater(Long toolContentID) throws DataMissingException, ToolException
- *
* @param toolContentID
* return void
*/
@@ -861,7 +603,7 @@
QaServicePOJO.logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
throw new DataMissingException("toolContentID is missing");
}
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
+ QaContent qaContent = qaDAO.getQaByContentId(toolContentID.longValue());
if (qaContent == null) {
QaServicePOJO.logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null.");
throw new DataMissingException("qaContent is missing");
@@ -883,7 +625,7 @@
QaServicePOJO.logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentID is null.");
throw new DataMissingException("toolContentID is missing");
}
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
+ QaContent qaContent = qaDAO.getQaByContentId(toolContentID.longValue());
if (qaContent == null) {
QaServicePOJO.logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null.");
throw new DataMissingException("qaContent is missing");
@@ -893,83 +635,18 @@
}
/**
+ * removeToolContent(Long toolContentID, boolean removeSessionData) throws
+ * SessionDataExistsException, ToolException Will need an update on the core
+ * tool signature: reason : when qaContent is null throw an exception
*
- * removeToolContent(Long toolContentID) gets automatically called only in monitoring mode when the author chooses
- * to delete a lesson.
- *
- * The idea is to remove content + its relevant sessions + in q/a tools's case the question's content from the db.
- * ToolContentManager CONTRACT this gets called automatically by Flash when a deletion is detected in the tool
- * interface.
*/
- public void removeToolContent(Long toolContentID) {
- QaServicePOJO.logger.debug("start of removeToolContent with toolContentID: " + toolContentID);
-
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
-
- if (qaContent != null) {
- Iterator sessionIterator = qaContent.getQaSessions().iterator();
- while (sessionIterator.hasNext()) {
- QaSession qaSession = (QaSession) sessionIterator.next();
-
- Iterator sessionUsersIterator = qaSession.getQaQueUsers().iterator();
- while (sessionUsersIterator.hasNext()) {
- QaQueUsr qaQueUsr = (QaQueUsr) sessionUsersIterator.next();
-
- Iterator sessionUsersResponsesIterator = qaQueUsr.getQaUsrResps().iterator();
- while (sessionUsersResponsesIterator.hasNext()) {
- QaUsrResp qaUsrResp = (QaUsrResp) sessionUsersResponsesIterator.next();
- removeUserResponse(qaUsrResp);
- QaServicePOJO.logger.debug("removed qaUsrResp : " + qaUsrResp.getQueUsrId());
- }
- }
- }
-
- QaServicePOJO.logger.debug("removed all existing responses of toolContent with toolContentID:"
- + toolContentID);
- qaDAO.removeQa(toolContentID);
- }
- }
-
- public void removeQuestions(Long toolContentID) throws QaApplicationException {
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
- qaContent.setQaQueContents(new TreeSet());
-
- if (qaContent != null) {
- Iterator sessionIterator = qaContent.getQaSessions().iterator();
- while (sessionIterator.hasNext()) {
- QaSession qaSession = (QaSession) sessionIterator.next();
-
- Iterator sessionUsersIterator = qaSession.getQaQueUsers().iterator();
- while (sessionUsersIterator.hasNext()) {
- QaQueUsr qaQueUsr = (QaQueUsr) sessionUsersIterator.next();
-
- Iterator sessionUsersResponsesIterator = qaQueUsr.getQaUsrResps().iterator();
- while (sessionUsersResponsesIterator.hasNext()) {
- QaUsrResp qaUsrResp = (QaUsrResp) sessionUsersResponsesIterator.next();
- removeUserResponse(qaUsrResp);
- }
- }
- }
- }
- }
-
- /**
- * removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException, ToolException
- * Will need an update on the core tool signature: reason : when qaContent is null throw an exception
- *
- */
public void removeToolContent(Long toolContentID, boolean removeSessionData) throws SessionDataExistsException,
ToolException {
- QaServicePOJO.logger.debug("start of: removeToolContent(Long toolContentID, boolean removeSessionData");
- QaServicePOJO.logger.debug("start of removeToolContent with toolContentID: " + toolContentID
- + "removeSessionData: " + removeSessionData);
-
if (toolContentID == null) {
- QaServicePOJO.logger.debug("toolContentID is null");
throw new ToolException("toolContentID is missing");
}
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
+ QaContent qaContent = qaDAO.getQaByContentId(toolContentID.longValue());
if (qaContent != null) {
Iterator sessionIterator = qaContent.getQaSessions().iterator();
@@ -989,13 +666,11 @@
while (sessionUsersResponsesIterator.hasNext()) {
QaUsrResp qaUsrResp = (QaUsrResp) sessionUsersResponsesIterator.next();
removeUserResponse(qaUsrResp);
- QaServicePOJO.logger.debug("removed qaUsrResp : " + qaUsrResp.getResponseId());
}
}
}
- QaServicePOJO.logger.debug("removed all existing responses of toolContent with toolContentID:"
- + toolContentID);
+ //removed all existing responses of toolContent with toolContentID
qaDAO.removeQa(toolContentID);
} else {
QaServicePOJO.logger.debug("Warning!!!, We should have not come here. qaContent is null.");
@@ -1004,9 +679,9 @@
}
public AverageRatingDTO rateResponse(Long responseId, Long userId, Long toolSessionID, float rating) {
- QaQueUsr imageGalleryUser = this.getQaUserBySession(userId, toolSessionID);
+ QaQueUsr imageGalleryUser = this.getUserByIdAndSession(userId, toolSessionID);
ResponseRating responseRating = qaResponseRatingDAO.getRatingByResponseAndUser(responseId, userId);
- QaUsrResp response = qaUsrRespDAO.getAttemptByUID(responseId);
+ QaUsrResp response = qaUsrRespDAO.getResponseById(responseId);
//persist ResponseRating changes in DB
if (responseRating == null) { // add
@@ -1035,10 +710,10 @@
*/
public void exportToolContent(Long toolContentID, String rootPath) throws DataMissingException, ToolException {
- QaContent toolContentObj = qaDAO.getQaById(toolContentID);
+ QaContent toolContentObj = qaDAO.getQaByContentId(toolContentID);
if (toolContentObj == null) {
long defaultToolContentId = toolService.getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE);
- toolContentObj = retrieveQa(defaultToolContentId);
+ toolContentObj = getQa(defaultToolContentId);
if (toolContentObj != null && toolContentObj.getConditions().isEmpty()) {
toolContentObj.getConditions().add(
getQaOutputFactory().createDefaultComplexUserAnswersCondition(toolContentObj));
@@ -1055,12 +730,10 @@
// don't export following fields value
toolContentObj.setQaSessions(null);
- Set questions = toolContentObj.getQaQueContents();
- for (QaQueContent question : questions) {
+ Set questions = toolContentObj.getQaQuestions();
+ for (QaQuestion question : questions) {
question.setQaQueUsers(null);
question.setQaContent(null);
- question.setQaUsrResps(null);
- question.setUserResponses(null);
}
Set files = toolContentObj.getQaUploadedFiles();
for (QaUploadedFile file : files) {
@@ -1106,8 +779,8 @@
toolContentObj.setCreatedBy(newUserUid);
// set back the tool content
- Set questions = toolContentObj.getQaQueContents();
- for (QaQueContent question : questions) {
+ Set questions = toolContentObj.getQaQuestions();
+ for (QaQuestion question : questions) {
question.setQaContent(toolContentObj);
}
Set files = toolContentObj.getQaUploadedFiles();
@@ -1130,10 +803,10 @@
*/
public SortedMap getToolOutputDefinitions(Long toolContentId, int definitionType)
throws ToolException {
- QaContent qaContent = qaDAO.getQaById(toolContentId);
+ QaContent qaContent = qaDAO.getQaByContentId(toolContentId);
if (qaContent == null) {
long defaultToolContentId = toolService.getToolDefaultContentIdBySignature(QaAppConstants.MY_SIGNATURE);
- qaContent = retrieveQa(defaultToolContentId);
+ qaContent = getQa(defaultToolContentId);
if (qaContent != null && qaContent.getConditions().isEmpty()) {
qaContent.getConditions().add(getQaOutputFactory().createDefaultComplexUserAnswersCondition(qaContent));
}
@@ -1150,7 +823,7 @@
*/
protected boolean existsSession(long toolSessionId) {
QaServicePOJO.logger.debug("toolSessionId: " + toolSessionId);
- QaSession qaSession = retrieveQaSessionOrNullById(toolSessionId);
+ QaSession qaSession = getSessionById(toolSessionId);
QaServicePOJO.logger.debug("qaSession: " + qaSession);
if (qaSession == null) {
@@ -1197,7 +870,7 @@
}
QaServicePOJO.logger.debug("final toolSessionId and toolContentID: " + toolSessionId + " " + toolContentID);
- QaContent qaContent = qaDAO.loadQaById(toolContentID.longValue());
+ QaContent qaContent = qaDAO.getQaByContentId(toolContentID.longValue());
if (qaContent == null) {
QaServicePOJO.logger.debug("qaContent is null.");
@@ -1215,7 +888,7 @@
+ QaAppConstants.MY_SIGNATURE + " Can't continue!");
}
- qaContent = qaDAO.loadQaById(toolContentID.longValue());
+ qaContent = qaDAO.getQaByContentId(toolContentID.longValue());
if (qaContent.getConditions().isEmpty()) {
qaContent.getConditions().add(getQaOutputFactory().createDefaultComplexUserAnswersCondition(qaContent));
}
@@ -1245,7 +918,7 @@
QaSession qaSession = null;
try {
- qaSession = retrieveQaSessionOrNullById(toolSessionId.longValue());
+ qaSession = getSessionById(toolSessionId.longValue());
} catch (QaApplicationException e) {
throw new DataMissingException("error retrieving qaSession: " + e);
} catch (Exception e) {
@@ -1259,7 +932,7 @@
try {
qaSessionDAO.deleteQaSession(qaSession);
- QaServicePOJO.logger.debug("qaSession " + qaSession.getUid() + " has been deleted successfully.");
+ QaServicePOJO.logger.debug("qaSession " + qaSession.getQaSessionId() + " has been deleted successfully.");
} catch (QaApplicationException e) {
throw new ToolException("error deleting qaSession:" + e);
}
@@ -1286,11 +959,11 @@
throw new DataMissingException("learnerId is missing");
}
- QaSession qaSession = retrieveQaSessionOrNullById(toolSessionId.longValue());
+ QaSession qaSession = getSessionById(toolSessionId.longValue());
qaSession.setSession_end_date(new Date(System.currentTimeMillis()));
qaSession.setSession_status(QaAppConstants.COMPLETED);
updateQaSession(qaSession);
- QaServicePOJO.logger.debug("tool session has been marked COMPLETE: " + qaSession.getUid());
+ QaServicePOJO.logger.debug("tool session has been marked COMPLETE: " + qaSession.getQaSessionId());
try {
String nextUrl = learnerService.completeToolSession(toolSessionId, learnerId);
@@ -1355,17 +1028,6 @@
return contentId;
}
- public QaQueContent getToolDefaultQuestionContent(long contentId) throws QaApplicationException {
- QaServicePOJO.logger.debug("before attempting retrieving QaQueContent with contentId : " + contentId);
- QaQueContent qaQueContent = qaQueContentDAO.getToolDefaultQuestionContent(contentId);
- return qaQueContent;
- }
-
- public List getToolSessionsForContent(QaContent qa) {
- List listToolSessionIds = qaSessionDAO.getToolSessionsForContent(qa);
- return listToolSessionIds;
- }
-
/**
* This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and
* access the Content Repository.
@@ -1524,10 +1186,10 @@
}
/**
- * @return Returns the qaQueContentDAO.
+ * @return Returns the qaQuestionDAO.
*/
- public IQaQueContentDAO getQaQueContentDAO() {
- return qaQueContentDAO;
+ public IQaQuestionDAO getQaQuestionDAO() {
+ return qaQuestionDAO;
}
/**
@@ -1563,8 +1225,8 @@
this.qaDAO = qaDAO;
}
- public void setQaQueContentDAO(IQaQueContentDAO qaQueContentDAO) {
- this.qaQueContentDAO = qaQueContentDAO;
+ public void setQaQuestionDAO(IQaQuestionDAO qaQuestionDAO) {
+ this.qaQuestionDAO = qaQuestionDAO;
}
public void setQaSessionDAO(IQaSessionDAO qaSessionDAO) {
@@ -1717,12 +1379,12 @@
// setQaSessions(Set qaSessions);
// set up question from body
- QaQueContent question = new QaQueContent();
+ QaQuestion question = new QaQuestion();
String content = WebUtil.convertNewlines((String) importValues.get(ToolContentImport102Manager.CONTENT_BODY));
question.setQuestion(content);
question.setDisplayOrder(1);
question.setQaContent(toolContentObj);
- toolContentObj.getQaQueContents().add(question);
+ toolContentObj.getQaQuestions().add(question);
qaDAO.saveOrUpdateQa(toolContentObj);
@@ -1736,7 +1398,7 @@
QaContent qaContent = null;
if (toolContentId != null) {
- qaContent = loadQa(toolContentId.longValue());
+ qaContent = getQa(toolContentId.longValue());
}
if (qaContent == null) {
throw new DataMissingException("Unable to set reflective data titled " + title
@@ -1792,10 +1454,10 @@
}
public QaContent getQaContentBySessionId(Long sessionId) {
- QaSession session = qaSessionDAO.getQaSessionOrNullById(sessionId);
+ QaSession session = qaSessionDAO.getQaSessionById(sessionId);
// to skip CGLib problem
Long contentId = session.getQaContent().getQaContentId();
- QaContent qaContent = qaDAO.getQaById(contentId);
+ QaContent qaContent = qaDAO.getQaByContentId(contentId);
return qaContent;
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java (.../QaServiceProxy.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServiceProxy.java (.../QaServiceProxy.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,6 +24,7 @@
package org.lamsfoundation.lams.tool.qa.service;
import javax.servlet.ServletContext;
+
import org.lamsfoundation.lams.tool.ToolContentManager;
import org.lamsfoundation.lams.tool.ToolSessionManager;
import org.springframework.web.context.WebApplicationContext;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaApplicationException.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaApplicationException.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaApplicationException.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,74 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.util;
+
+/**
+ *
+ * This exception wraps all basic exception occured in the q/a tool. It is not
+ * suppose to be try and catched in any level. The struts should be taking care
+ * of handling this exception.
+ *
+ *
+ * @author Ozgur Demirtas
+ *
+ */
+public class QaApplicationException extends RuntimeException {
+ /**
+ * Default Constructor
+ */
+ public QaApplicationException() {
+ super();
+ }
+
+ /**
+ * Constructor for customized error message
+ *
+ * @param message
+ */
+ public QaApplicationException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor for wrapping the throwable object
+ *
+ * @param cause
+ */
+ public QaApplicationException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructor for wrapping both the customized error message and throwable
+ * exception object.
+ *
+ * @param message
+ * @param cause
+ */
+ public QaApplicationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaComparator.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaComparator.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaComparator.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,55 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.util;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+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.
+ *
+ */
+public class QaComparator implements Comparator, Serializable {
+ static Logger logger = Logger.getLogger(QaComparator.class.getName());
+
+ public int compare(Object o1, Object o2) {
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+
+ int key1 = new Long(s1).intValue();
+ int key2 = new Long(s2).intValue();
+ return key1 - key2;
+ }
+
+ public boolean equals(Object o) {
+ String s = (String) o;
+ return compare(this, o) == 0;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java (.../QaQueContentComparator.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQueContentComparator.java (.../QaQueContentComparator.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -2,20 +2,20 @@
import java.util.Comparator;
-import org.lamsfoundation.lams.tool.qa.QaQueContent;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
/**
- * Comparator for QaQueContent. Only the display order is
+ * Comparator for QaQuestion. Only the display order is
* compared.
*
* @author Marcin Cieslak
*/
-public class QaQueContentComparator implements Comparator {
+public class QaQueContentComparator implements Comparator {
/**
* {@inheritDoc}
*/
- public int compare(QaQueContent o1, QaQueContent o2) {
+ public int compare(QaQuestion o1, QaQuestion o2) {
if (o1 != null && o2 != null) {
return o1.getDisplayOrder() - o2.getDisplayOrder();
} else if (o1 != null) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java (.../QaQuestionContentDTOComparator.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaQuestionContentDTOComparator.java (.../QaQuestionContentDTOComparator.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -2,20 +2,20 @@
import java.util.Comparator;
-import org.lamsfoundation.lams.tool.qa.QaQuestionContentDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO;
/**
- * Comparator for QaQuestionContentDTO. Only the display order
+ * Comparator for QaQuestionDTO. Only the display order
* is compared.
*
* @author Marcin Cieslak
*/
-public class QaQuestionContentDTOComparator implements Comparator {
+public class QaQuestionContentDTOComparator implements Comparator {
/**
* {@inheritDoc}
*/
- public int compare(QaQuestionContentDTO o1, QaQuestionContentDTO o2) {
+ public int compare(QaQuestionDTO o1, QaQuestionDTO o2) {
if (o1 != null && o2 != null) {
return Integer.parseInt(o1.getDisplayOrder()) - Integer.parseInt(o2.getDisplayOrder());
} else if (o1 != null) {
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaStringComparator.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaStringComparator.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaStringComparator.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,52 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.util;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+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.
+ *
+ */
+public class QaStringComparator implements Comparator, Serializable {
+ static Logger logger = Logger.getLogger(QaStringComparator.class.getName());
+
+ public int compare(Object o1, Object o2) {
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+
+ return s1.compareTo(s2);
+ }
+
+ public boolean equals(Object o) {
+ String s = (String) o;
+ return compare(this, o) == 0;
+ }
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java
===================================================================
diff -u
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java (revision 0)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/util/QaUtils.java (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,497 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.qa.util;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.tool.qa.QaAppConstants;
+import org.lamsfoundation.lams.tool.qa.QaContent;
+import org.lamsfoundation.lams.tool.qa.QaSession;
+import org.lamsfoundation.lams.tool.qa.QaUploadedFile;
+import org.lamsfoundation.lams.tool.qa.dto.QaGeneralAuthoringDTO;
+import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.web.form.QaAuthoringForm;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+
+/**
+ * @author Ozgur Demirtas
+ *
+ * Common utility functions live here.
+ */
+public abstract class QaUtils implements QaAppConstants {
+ static Logger logger = Logger.getLogger(QaUtils.class.getName());
+
+ /**
+ *
+ * @param request
+ * @param defaultQaContent
+ * @param qaAuthoringForm
+ */
+ public static void populateAuthoringDTO(HttpServletRequest request, QaContent defaultQaContent,
+ QaGeneralAuthoringDTO qaGeneralAuthoringDTO) {
+ qaGeneralAuthoringDTO.setActivityTitle(defaultQaContent.getTitle());
+ qaGeneralAuthoringDTO.setActivityInstructions(defaultQaContent.getInstructions());
+
+ qaGeneralAuthoringDTO.setOnlineInstructions(defaultQaContent.getOnlineInstructions());
+ qaGeneralAuthoringDTO.setOfflineInstructions(defaultQaContent.getOfflineInstructions());
+ }
+
+ public static String replaceNewLines(String text) {
+
+ String newText = "";
+ if (text != null) {
+ newText = text.replaceAll("\n", " ");
+
+ }
+
+ return newText;
+ }
+
+ public static void setFormProperties(HttpServletRequest request, IQaService qaService,
+ QaAuthoringForm qaAuthoringForm, QaGeneralAuthoringDTO qaGeneralAuthoringDTO, String strToolContentID,
+ String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) {
+
+ qaAuthoringForm.setHttpSessionID(httpSessionID);
+ qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID);
+
+ qaAuthoringForm.setToolContentID(strToolContentID);
+
+ if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0))
+ qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString());
+
+ qaAuthoringForm.setActiveModule(activeModule);
+ qaGeneralAuthoringDTO.setActiveModule(activeModule);
+
+ String synchInMonitor = request.getParameter(SYNC_IN_MONITOR);
+ qaAuthoringForm.setSynchInMonitor(synchInMonitor);
+ qaGeneralAuthoringDTO.setSynchInMonitor(synchInMonitor);
+
+ String usernameVisible = request.getParameter(USERNAME_VISIBLE);
+ qaAuthoringForm.setUsernameVisible(usernameVisible);
+ qaGeneralAuthoringDTO.setUsernameVisible(usernameVisible);
+
+ String allowRateAnswers = request.getParameter(ALLOW_RATE_ANSWERS);
+ qaAuthoringForm.setAllowRateAnswers(allowRateAnswers);
+ qaGeneralAuthoringDTO.setAllowRateAnswers(allowRateAnswers);
+
+ String showOtherAnswers = request.getParameter("showOtherAnswers");
+ qaAuthoringForm.setShowOtherAnswers(showOtherAnswers);
+ qaGeneralAuthoringDTO.setShowOtherAnswers(showOtherAnswers);
+
+ String questionsSequenced = request.getParameter(QUESTIONS_SEQUENCED);
+ qaAuthoringForm.setQuestionsSequenced(questionsSequenced);
+ qaGeneralAuthoringDTO.setQuestionsSequenced(questionsSequenced);
+
+ String lockWhenFinished = request.getParameter("lockWhenFinished");
+ qaAuthoringForm.setLockWhenFinished(lockWhenFinished);
+ qaGeneralAuthoringDTO.setLockWhenFinished(lockWhenFinished);
+
+ String offlineInstructions = request.getParameter(OFFLINE_INSTRUCTIONS);
+
+ qaAuthoringForm.setOfflineInstructions(offlineInstructions);
+ qaGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions);
+
+ String onlineInstructions = request.getParameter(ONLINE_INSTRUCTIONS);
+
+ qaAuthoringForm.setOnlineInstructions(onlineInstructions);
+ qaGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions);
+
+ String reflect = request.getParameter(REFLECT);
+
+ qaAuthoringForm.setReflect(reflect);
+ qaGeneralAuthoringDTO.setReflect(reflect);
+
+ String reflectionSubject = request.getParameter(REFLECTION_SUBJECT);
+
+ qaAuthoringForm.setReflectionSubject(reflectionSubject);
+ qaGeneralAuthoringDTO.setReflectionSubject(reflectionSubject);
+
+
+
+ }
+
+ public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException {
+ HttpSession ss = SessionManager.getSession();
+ /* get back login user DTO */
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return user.getUserID().intValue();
+ }
+
+ /**
+ * existsContent(long toolContentID)
+ *
+ * @param long
+ * toolContentID
+ * @return boolean determine whether a specific toolContentID exists in the
+ * db
+ */
+ public static boolean existsContent(long toolContentID, IQaService qaService) {
+ QaContent qaContent = qaService.getQa(toolContentID);
+ if (qaContent == null)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * it is expected that the tool session id already exists in the tool
+ * sessions table existsSession(long toolSessionId)
+ *
+ * @param toolSessionId
+ * @return boolean
+ */
+ public static boolean existsSession(long toolContentID, IQaService qaService) {
+ logger.debug("existsSession");
+ QaSession qaSession = qaService.getSessionById(toolContentID);
+
+
+ if (qaSession == null)
+ return false;
+
+ return true;
+ }
+
+ public static String getFormattedDateString(Date date) {
+ return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date));
+ }
+
+ /**
+ * If this file exists in attachments map, move it to the deleted
+ * attachments map. Returns the updated deletedAttachments map, creating a
+ * new one if needed. If uuid supplied then tries to match on that,
+ * otherwise uses filename and isOnline.
+ */
+ public static List moveToDelete(String uuid, List attachmentsList, List deletedAttachmentsList) {
+
+ List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList();
+
+ if (attachmentsList != null) {
+ Iterator iter = attachmentsList.iterator();
+ QaUploadedFile attachment = null;
+ while (iter.hasNext() && attachment == null) {
+ QaUploadedFile value = (QaUploadedFile) iter.next();
+ if (uuid.equals(value.getUuid())) {
+ attachment = value;
+ }
+
+ }
+ if (attachment != null) {
+ deletedList.add(attachment);
+ attachmentsList.remove(attachment);
+ }
+ }
+
+ 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();
+ QaUploadedFile attachment = null;
+ while (iter.hasNext() && attachment == null) {
+ QaUploadedFile value = (QaUploadedFile) iter.next();
+ if (filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) {
+ attachment = value;
+ }
+
+ }
+ if (attachment != null) {
+ deletedList.add(attachment);
+ attachmentsList.remove(attachment);
+ }
+ }
+
+ return deletedList;
+ }
+
+ /**
+ * builds a String based map from a list convertToMap(List sessionsList)
+ *
+ * @param sessionsList
+ * @return Map
+ */
+ public static Map convertToStringMap(List sessionsList, String listType) {
+ Map map = new TreeMap(new QaComparator());
+
+ Iterator listIterator = sessionsList.iterator();
+ Long mapIndex = new Long(1);
+
+ while (listIterator.hasNext()) {
+ if (listType.equals("String")) {
+ String text = (String) listIterator.next();
+ map.put(mapIndex.toString(), text);
+ } else if (listType.equals("Long")) {
+ Long LongValue = (Long) listIterator.next();
+ map.put(mapIndex.toString(), LongValue.toString());
+ }
+ mapIndex = new Long(mapIndex.longValue() + 1);
+ }
+ return map;
+ }
+
+ /**
+ * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID and
+ * ACTIVITY_TITLE ACTIVITY_INSTRUCTIONS
+ * cleanUpSessionAbsolute(HttpServletRequest request)
+ *
+ * @param request
+ */
+ public static void cleanUpSessionAbsolute(HttpServletRequest request) {
+ request.getSession().removeAttribute(MY_SIGNATURE);
+ request.getSession().removeAttribute(ERROR_QAAPPLICATION);
+ request.getSession().removeAttribute(TARGET_MODE);
+ request.getSession().removeAttribute(TARGET_MODE_AUTHORING);
+ request.getSession().removeAttribute(TARGET_MODE_LEARNING);
+ request.getSession().removeAttribute(TARGET_MODE_MONITORING);
+ request.getSession().removeAttribute(TARGET_MODE_EXPORT_PORTFOLIO);
+ request.getSession().removeAttribute(AUTHORING_STARTER);
+ request.getSession().removeAttribute(LOAD_LEARNER);
+ request.getSession().removeAttribute(LEARNING_STARTER);
+ request.getSession().removeAttribute(MONITORING_STARTER);
+ request.getSession().removeAttribute(LOAD_MONITORING);
+ request.getSession().removeAttribute(EDIT_RESPONSE);
+ request.getSession().removeAttribute(EDITABLE_RESPONSE_ID);
+ request.getSession().removeAttribute(COPY_TOOL_CONTENT);
+ request.getSession().removeAttribute(ERROR_LIST);
+ request.getSession().removeAttribute(ERROR_LIST_LEARNER);
+ request.getSession().removeAttribute(DEFAULT_CONTENT_ID_STR);
+ request.getSession().removeAttribute(TOOL_SESSION_ID);
+ request.getSession().removeAttribute(LOAD);
+ request.getSession().removeAttribute(LOAD_QUESTIONS);
+ request.getSession().removeAttribute(LOAD_STARTER);
+ request.getSession().removeAttribute(IS_DEFINE_LATER);
+ request.getSession().removeAttribute(LEARNING_MODE);
+ request.getSession().removeAttribute(IS_ADD_QUESTION);
+ request.getSession().removeAttribute(IS_REMOVE_QUESTION);
+ request.getSession().removeAttribute(IS_REMOVE_CONTENT);
+ request.getSession().removeAttribute(SELECTION_CASE);
+ request.getSession().removeAttribute(MAP_QUESTION_CONTENT);
+ request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT);
+ request.getSession().removeAttribute(ONLINE_INSTRUCTIONS);
+ request.getSession().removeAttribute(OFFLINE_INSTRUCTIONS);
+ request.getSession().removeAttribute(END_LEARNING_MESSSAGE);
+ request.getSession().removeAttribute(ON);
+ request.getSession().removeAttribute(OFF);
+ request.getSession().removeAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_ONLINEINSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_TITLE);
+ request.getSession().removeAttribute(RICHTEXT_INSTRUCTIONS);
+ request.getSession().removeAttribute(RICHTEXT_BLANK);
+ request.getSession().removeAttribute(SUBMIT_OFFLINE_FILE);
+ request.getSession().removeAttribute(SUBMIT_ONLINE_FILE);
+ request.getSession().removeAttribute(POPULATED_UPLOADED_FILESDATA);
+ request.getSession().removeAttribute(USER_ID);
+ request.getSession().removeAttribute(NOT_ATTEMPTED);
+ request.getSession().removeAttribute(INCOMPLETE);
+ request.getSession().removeAttribute(COMPLETED);
+ request.getSession().removeAttribute(MAP_TOOL_SESSIONS);
+ request.getSession().removeAttribute(MAX_TOOL_SESSION_COUNT.toString());
+ request.getSession().removeAttribute(IS_TOOL_SESSION_CHANGED);
+ request.getSession().removeAttribute(COUNT_SESSION_COMPLETE);
+ request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION);
+ request.getSession().removeAttribute(COUNT_ALL_USERS);
+ request.getSession().removeAttribute(LIST_MONITORED_ANSWERS_CONTAINER_DTO);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS);
+ request.getSession().removeAttribute(SUMMARY_TOOL_SESSIONS_ID);
+ request.getSession().removeAttribute(MODE);
+ request.getSession().removeAttribute(LEARNER);
+ request.getSession().removeAttribute(TEACHER);
+ request.getSession().removeAttribute(PORTFOLIO_REPORT);
+ request.getSession().removeAttribute(PORTFOLIO_REQUEST);
+ request.getSession().removeAttribute(ADD_NEW_QUESTION);
+ request.getSession().removeAttribute(REMOVE_QUESTION);
+ request.getSession().removeAttribute(REMOVE_ALL_CONTENT);
+ request.getSession().removeAttribute(SUBMIT_ALL_CONTENT);
+ request.getSession().removeAttribute(SUBMIT_TAB_DONE);
+ request.getSession().removeAttribute(OPTION_OFF);
+ request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER);
+ request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
+ request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
+ request.getSession().removeAttribute(TOTAL_QUESTION_COUNT);
+ request.getSession().removeAttribute(MAP_ANSWERS);
+ request.getSession().removeAttribute(USER_FEEDBACK);
+ request.getSession().removeAttribute(REPORT_TITLE);
+ request.getSession().removeAttribute(MONITORING_REPORT_TITLE);
+ request.getSession().removeAttribute(REPORT_TITLE_LEARNER);
+ request.getSession().removeAttribute(END_LEARNING_MESSAGE);
+ request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE);
+ request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED);
+ request.getSession().removeAttribute(FROM_TOOL_CONTENT_ID);
+ request.getSession().removeAttribute(TO_TOOL_CONTENT_ID);
+ request.getSession().removeAttribute(LEARNER_REPORT);
+ request.getSession().removeAttribute(EDITACTIVITY_EDITMODE);
+ request.getSession().removeAttribute(RENDER_MONITORING_EDITACTIVITY);
+ request.getSession().removeAttribute(NO_AVAILABLE_SESSIONS);
+ request.getSession().removeAttribute(NO_TOOL_SESSIONS_AVAILABLE);
+ request.getSession().removeAttribute(TIMEZONE);
+ request.getSession().removeAttribute(TIMEZONE_ID);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED);
+ request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED);
+ request.getSession().removeAttribute(FEEDBACK_TYPE_SEQUENTIAL);
+ request.getSession().removeAttribute(FEEDBACK_TYPE_COMBINED);
+ request.getSession().removeAttribute(QUESTIONS);
+ request.getSession().removeAttribute(ATTACHMENT_LIST);
+ request.getSession().removeAttribute(SUBMIT_SUCCESS);
+ request.getSession().removeAttribute(DELETED_ATTACHMENT_LIST);
+ request.getSession().removeAttribute(UUID);
+ request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
+ request.getSession().removeAttribute(CURRENT_ANSWER);
+ request.getSession().removeAttribute(ACTIVE_MODULE);
+ request.getSession().removeAttribute(AUTHORING);
+ request.getSession().removeAttribute(DEFINE_LATER_IN_EDIT_MODE);
+ request.getSession().removeAttribute(SHOW_AUTHORING_TABS);
+ request.getSession().removeAttribute(DEFINE_LATER);
+ request.getSession().removeAttribute(SOURCE_MC_STARTER);
+ request.getSession().removeAttribute(IS_MONITORED_CONTENT_IN_USE);
+ request.getSession().removeAttribute(LOAD_MONITORING_CONTENT_EDITACTIVITY);
+ request.getSession().removeAttribute(MONITORING_ORIGINATED_DEFINELATER);
+ request.getSession().removeAttribute(REQUEST_LEARNING_REPORT);
+ request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_VIEWONLY);
+ request.getSession().removeAttribute(REQUEST_PREVIEW);
+ request.getSession().removeAttribute(REQUEST_LEARNING_REPORT_PROGRESS);
+
+ request.getSession().removeAttribute(USER_EXCEPTION_WRONG_FORMAT);
+ request.getSession().removeAttribute(USER_EXCEPTION_UNCOMPATIBLE_IDS);
+ request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT);
+ request.getSession().removeAttribute(USER_EXCEPTION_USER_DOESNOTEXIST);
+ //request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST);
+ request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST);
+ request.getSession().removeAttribute(USER_EXCEPTION_CONTENTID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_NOTNUMERIC);
+ request.getSession().removeAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS);
+ request.getSession().removeAttribute(USER_EXCEPTION_USERID_EXISTING);
+ request.getSession().removeAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP);
+ request.getSession().removeAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS);
+ request.getSession().removeAttribute(USER_EXCEPTION_NO_STUDENT_ACTIVITY);
+ request.getSession().removeAttribute(USER_EXCEPTION_CONTENT_IN_USE);
+ request.getSession().removeAttribute(USER_EXCEPTION_MODE_REQUIRED);
+ request.getSession().removeAttribute(USER_EXCEPTION_RUN_OFFLINE);
+ request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID);
+ request.getSession().removeAttribute(USER_EXCEPTION_QUESTIONS_DUPLICATE);
+ }
+
+ /**
+ * setDefineLater(HttpServletRequest request, boolean value, String
+ * toolContentID)
+ *
+ * @param request
+ * @param value
+ * @param toolContentID
+ */
+ public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID,
+ IQaService qaService) {
+
+ logger.debug("value:" + value);
+ logger.debug("strToolContentID:" + strToolContentID);
+
+ QaContent qaContent = qaService.getQa(new Long(strToolContentID).longValue());
+
+ if (qaContent != null) {
+ qaContent.setDefineLater(value);
+ logger.debug("defineLater has been set to:" + value);
+ qaService.updateQa(qaContent);
+ }
+ }
+
+ /**
+ * determines the struts level location to return
+ *
+ * @param sourceMcStarter
+ * @param requestedModule
+ * @return
+ */
+ public static String getDestination(String sourceMcStarter, String requestedModule) {
+ logger.debug("sourceMcStarter: " + sourceMcStarter + " and requestedModule:" + requestedModule);
+
+ if (requestedModule.equals(DEFINE_LATER)) {
+ logger.debug("request is from define Later url. return to: " + LOAD_VIEW_ONLY);
+ return LOAD_VIEW_ONLY;
+ } else if (requestedModule.equals(AUTHORING)) {
+ logger.debug("request is from authoring url. return to: " + LOAD_QUESTIONS);
+ return LOAD_QUESTIONS;
+ } else {
+ logger.debug("request is from an unknown source. return null");
+ return null;
+ }
+ }
+
+ public static void setDefineLater(HttpServletRequest request, boolean value, IQaService qaService,
+ String toolContentID) {
+
+ logger.debug("toolContentID:" + toolContentID);
+
+ QaContent qaContent = qaService.getQa(new Long(toolContentID).longValue());
+
+ if (qaContent != null) {
+ qaContent.setDefineLater(value);
+ logger.debug("defineLater has been set to true");
+ qaService.updateQa(qaContent);
+ }
+ }
+
+ public static String getCurrentLearnerID() {
+ String userID = "";
+ HttpSession ss = SessionManager.getSession();
+
+
+ if (ss != null) {
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ if ((user != null) && (user.getUserID() != null)) {
+ userID = user.getUserID().toString();
+ logger.debug("retrieved userId: " + userID);
+ }
+ }
+ return userID;
+ }
+
+}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -41,14 +41,15 @@
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
-import org.lamsfoundation.lams.tool.qa.QaComparator;
import org.lamsfoundation.lams.tool.qa.QaCondition;
import org.lamsfoundation.lams.tool.qa.QaContent;
-import org.lamsfoundation.lams.tool.qa.QaQueContent;
-import org.lamsfoundation.lams.tool.qa.QaQuestionContentDTO;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
+import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.util.QaComparator;
import org.lamsfoundation.lams.tool.qa.util.QaQueContentComparator;
import org.lamsfoundation.lams.tool.qa.util.QaQuestionContentDTOComparator;
+import org.lamsfoundation.lams.tool.qa.web.form.QaAuthoringForm;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -83,9 +84,9 @@
AuthoringUtil.logger.debug("replacedNodeIndex:" + replacedNodeIndex);
AuthoringUtil.logger.debug("replacing nodes:" + intOriginalQuestionIndex + " and " + replacedNodeIndex);
- QaQuestionContentDTO mainNode = extractNodeAtDisplayOrder(listQuestionContentDTO, intOriginalQuestionIndex);
+ QaQuestionDTO mainNode = extractNodeAtDisplayOrder(listQuestionContentDTO, intOriginalQuestionIndex);
- QaQuestionContentDTO replacedNode = extractNodeAtDisplayOrder(listQuestionContentDTO, replacedNodeIndex);
+ QaQuestionDTO replacedNode = extractNodeAtDisplayOrder(listQuestionContentDTO, replacedNodeIndex);
List listFinalQuestionContentDTO = new LinkedList();
@@ -96,31 +97,31 @@
}
protected static List reorderSwappedListQuestionContentDTO(List listQuestionContentDTO,
- int intOriginalQuestionIndex, int replacedNodeIndex, QaQuestionContentDTO mainNode,
- QaQuestionContentDTO replacedNode, Set conditions) {
+ int intOriginalQuestionIndex, int replacedNodeIndex, QaQuestionDTO mainNode,
+ QaQuestionDTO replacedNode, Set conditions) {
AuthoringUtil.logger.debug("reorderSwappedListQuestionContentDTO:");
List listFinalQuestionContentDTO = new LinkedList();
int queIndex = 0;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
+ QaQuestionDTO qaQuestionDTO = (QaQuestionDTO) listIterator.next();
queIndex++;
- QaQuestionContentDTO tempNode = null;
+ QaQuestionDTO tempNode = null;
- if (!qaQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())
- && !qaQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
+ if (!qaQuestionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())
+ && !qaQuestionDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
AuthoringUtil.logger.debug("normal copy ");
- tempNode = new QaQuestionContentDTO(qaQuestionContentDTO.getQuestion(),
- qaQuestionContentDTO.getDisplayOrder(), qaQuestionContentDTO.getFeedback(), qaQuestionContentDTO.isRequired());
- } else if (qaQuestionContentDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) {
+ tempNode = new QaQuestionDTO(qaQuestionDTO.getQuestion(),
+ qaQuestionDTO.getDisplayOrder(), qaQuestionDTO.getFeedback(), qaQuestionDTO.isRequired());
+ } else if (qaQuestionDTO.getDisplayOrder().equals(new Integer(intOriginalQuestionIndex).toString())) {
AuthoringUtil.logger.debug("move type 1 ");
- tempNode = new QaQuestionContentDTO(replacedNode.getQuestion(),
+ tempNode = new QaQuestionDTO(replacedNode.getQuestion(),
replacedNode.getDisplayOrder(),replacedNode.getFeedback(), replacedNode.isRequired());
- } else if (qaQuestionContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
+ } else if (qaQuestionDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) {
AuthoringUtil.logger.debug("move type 1 ");
- tempNode = new QaQuestionContentDTO(mainNode.getQuestion(),
+ tempNode = new QaQuestionDTO(mainNode.getQuestion(),
mainNode.getDisplayOrder(), mainNode.getFeedback(), mainNode.isRequired());
}
@@ -129,9 +130,9 @@
// references in conditions also need to be changed
if (conditions != null) {
for (QaCondition condition : conditions) {
- SortedSet newQuestionDTOSet = new TreeSet(
+ SortedSet newQuestionDTOSet = new TreeSet(
new QaQuestionContentDTOComparator());
- for (QaQuestionContentDTO dto : (List) listFinalQuestionContentDTO) {
+ for (QaQuestionDTO dto : (List) listFinalQuestionContentDTO) {
if (condition.temporaryQuestionDTOSet.contains(dto)) {
newQuestionDTOSet.add(dto);
}
@@ -142,18 +143,18 @@
return listFinalQuestionContentDTO;
}
- protected static QaQuestionContentDTO extractNodeAtDisplayOrder(List listQuestionContentDTO,
+ protected static QaQuestionDTO extractNodeAtDisplayOrder(List listQuestionContentDTO,
int intOriginalQuestionIndex) {
AuthoringUtil.logger.debug("intOriginalQuestionIndex:" + intOriginalQuestionIndex);
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
+ QaQuestionDTO qaQuestionDTO = (QaQuestionDTO) listIterator.next();
AuthoringUtil.logger.debug("intOriginalQuestionIndex versus displayOrder:"
+ new Integer(intOriginalQuestionIndex).toString() + " versus "
- + qaQuestionContentDTO.getDisplayOrder());
- if (new Integer(intOriginalQuestionIndex).toString().equals(qaQuestionContentDTO.getDisplayOrder())) {
- return qaQuestionContentDTO;
+ + qaQuestionDTO.getDisplayOrder());
+ if (new Integer(intOriginalQuestionIndex).toString().equals(qaQuestionDTO.getDisplayOrder())) {
+ return qaQuestionDTO;
}
}
return null;
@@ -185,15 +186,15 @@
int queIndex = 0;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
+ QaQuestionDTO qaQuestionDTO = (QaQuestionDTO) listIterator.next();
- String question = qaQuestionContentDTO.getQuestion();
+ String question = qaQuestionDTO.getQuestion();
- String displayOrder = qaQuestionContentDTO.getDisplayOrder();
+ String displayOrder = qaQuestionDTO.getDisplayOrder();
AuthoringUtil.logger.debug("displayOrder:" + displayOrder);
- String feedback = qaQuestionContentDTO.getFeedback();
- boolean required = qaQuestionContentDTO.isRequired();
+ String feedback = qaQuestionDTO.getFeedback();
+ boolean required = qaQuestionDTO.isRequired();
AuthoringUtil.logger.debug("displayOrder versus excludeQuestionIndex :" + displayOrder + " versus "
+ excludeQuestionIndex);
@@ -202,12 +203,12 @@
if (!displayOrder.equals(excludeQuestionIndex)) {
++queIndex;
- qaQuestionContentDTO.setQuestion(question);
- qaQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString());
- qaQuestionContentDTO.setFeedback(feedback);
- qaQuestionContentDTO.setRequired(required);
+ qaQuestionDTO.setQuestion(question);
+ qaQuestionDTO.setDisplayOrder(new Integer(queIndex).toString());
+ qaQuestionDTO.setFeedback(feedback);
+ qaQuestionDTO.setRequired(required);
- listFinalQuestionContentDTO.add(qaQuestionContentDTO);
+ listFinalQuestionContentDTO.add(qaQuestionDTO);
}
}
}
@@ -221,29 +222,29 @@
int queIndex = 0;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
+ QaQuestionDTO qaQuestionDTO = (QaQuestionDTO) listIterator.next();
- String question = qaQuestionContentDTO.getQuestion();
- String displayOrder = qaQuestionContentDTO.getDisplayOrder();
- String feedback = qaQuestionContentDTO.getFeedback();
- boolean required = qaQuestionContentDTO.isRequired();
+ String question = qaQuestionDTO.getQuestion();
+ String displayOrder = qaQuestionDTO.getDisplayOrder();
+ String feedback = qaQuestionDTO.getFeedback();
+ boolean required = qaQuestionDTO.isRequired();
if (question != null && !question.equals("")) {
++queIndex;
- qaQuestionContentDTO.setQuestion(question);
- qaQuestionContentDTO.setDisplayOrder(new Integer(queIndex).toString());
- qaQuestionContentDTO.setFeedback(feedback);
- qaQuestionContentDTO.setRequired(required);
+ qaQuestionDTO.setQuestion(question);
+ qaQuestionDTO.setDisplayOrder(new Integer(queIndex).toString());
+ qaQuestionDTO.setFeedback(feedback);
+ qaQuestionDTO.setRequired(required);
- listFinalQuestionContentDTO.add(qaQuestionContentDTO);
+ listFinalQuestionContentDTO.add(qaQuestionDTO);
}
}
return listFinalQuestionContentDTO;
}
protected static List reorderUpdateListQuestionContentDTO(List listQuestionContentDTO,
- QaQuestionContentDTO qaQuestionContentDTONew, String editableQuestionIndex) {
+ QaQuestionDTO qaQuestionContentDTONew, String editableQuestionIndex) {
AuthoringUtil.logger.debug("reorderUpdateListQuestionContentDTO");
AuthoringUtil.logger.debug("editableQuestionIndex:" + editableQuestionIndex);
@@ -252,29 +253,29 @@
int queIndex = 0;
Iterator listIterator = listQuestionContentDTO.iterator();
while (listIterator.hasNext()) {
- QaQuestionContentDTO qaQuestionContentDTO = (QaQuestionContentDTO) listIterator.next();
+ QaQuestionDTO qaQuestionDTO = (QaQuestionDTO) listIterator.next();
++queIndex;
- String question = qaQuestionContentDTO.getQuestion();
- String displayOrder = qaQuestionContentDTO.getDisplayOrder();
- String feedback = qaQuestionContentDTO.getFeedback();
- boolean required = qaQuestionContentDTO.isRequired();
+ String question = qaQuestionDTO.getQuestion();
+ String displayOrder = qaQuestionDTO.getDisplayOrder();
+ String feedback = qaQuestionDTO.getFeedback();
+ boolean required = qaQuestionDTO.isRequired();
if (displayOrder.equals(editableQuestionIndex)) {
- qaQuestionContentDTO.setQuestion(qaQuestionContentDTONew.getQuestion());
- qaQuestionContentDTO.setDisplayOrder(qaQuestionContentDTONew.getDisplayOrder());
- qaQuestionContentDTO.setFeedback(qaQuestionContentDTONew.getFeedback());
- qaQuestionContentDTO.setRequired(required);
+ qaQuestionDTO.setQuestion(qaQuestionContentDTONew.getQuestion());
+ qaQuestionDTO.setDisplayOrder(qaQuestionContentDTONew.getDisplayOrder());
+ qaQuestionDTO.setFeedback(qaQuestionContentDTONew.getFeedback());
+ qaQuestionDTO.setRequired(required);
- listFinalQuestionContentDTO.add(qaQuestionContentDTO);
+ listFinalQuestionContentDTO.add(qaQuestionDTO);
} else {
- qaQuestionContentDTO.setQuestion(question);
- qaQuestionContentDTO.setDisplayOrder(displayOrder);
- qaQuestionContentDTO.setFeedback(feedback);
- qaQuestionContentDTO.setRequired(required);
+ qaQuestionDTO.setQuestion(question);
+ qaQuestionDTO.setDisplayOrder(displayOrder);
+ qaQuestionDTO.setFeedback(feedback);
+ qaQuestionDTO.setRequired(required);
- listFinalQuestionContentDTO.add(qaQuestionContentDTO);
+ listFinalQuestionContentDTO.add(qaQuestionDTO);
}
}
@@ -305,7 +306,7 @@
}
}
- public QaContent saveOrUpdateQaContent(List listQuestionContentDTO, 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);
@@ -431,15 +432,15 @@
qaService.updateQa(qaContent);
}
- qaContent = qaService.loadQa(new Long(strToolContentID).longValue());
+ qaContent = qaService.getQa(new Long(strToolContentID).longValue());
qaContent = createQuestionContent(listQuestionContentDTO, qaService, qaContent);
- qaContent = qaService.loadQa(new Long(strToolContentID).longValue());
+ qaContent = qaService.getQa(new Long(strToolContentID).longValue());
for (QaCondition condition : conditions) {
- condition.setQuestions(new TreeSet(new QaQueContentComparator()));
- for (QaQuestionContentDTO dto : condition.temporaryQuestionDTOSet) {
- for (QaQueContent queContent : (Set) qaContent.getQaQueContents()) {
+ condition.setQuestions(new TreeSet(new QaQueContentComparator()));
+ for (QaQuestionDTO dto : condition.temporaryQuestionDTOSet) {
+ for (QaQuestion queContent : (Set) qaContent.getQaQuestions()) {
if (dto.getDisplayOrder().equals(String.valueOf(queContent.getDisplayOrder()))) {
condition.getQuestions().add(queContent);
}
@@ -452,23 +453,17 @@
}
/**
- * removes unused question entries from db removeRedundantQuestions (Map
- * mapQuestionContent, IQaService qaService, QaAuthoringForm
- * qaAuthoringForm)
+ * removes unused question entries from db
*
* @param mapQuestionContent
* @param qaService
* @param qaAuthoringForm
*/
- public void removeRedundantQuestions(ListlistQuestionContentDTO, 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);
- QaContent qaContent = qaService.loadQa(new Long(toolContentID).longValue());
-
+ QaContent qaContent = qaService.getQa(new Long(toolContentID).longValue());
if (qaContent != null) {
- AuthoringUtil.logger.debug("qaContent uid: " + qaContent.getUid());
List allQuestions = qaService.getAllQuestionEntries(qaContent.getUid());
Iterator listIterator = allQuestions.iterator();
@@ -477,12 +472,12 @@
while (listIterator.hasNext()) {
++mapIndex;
- QaQueContent queContent = (QaQueContent) listIterator.next();
+ QaQuestion queContent = (QaQuestion) listIterator.next();
- AuthoringUtil.logger.info("Checking whether to remove question with id=" + queContent.getUid() + ", displayOrder=" + queContent.getDisplayOrder() + ", question=" + queContent.getQuestion());
+ //Checking whether to remove question with id queContent.getUid()
entryUsed = false;
int displayOrder = 0;
- for ( QaQuestionContentDTO questionDTO : listQuestionContentDTO ) {
+ for ( QaQuestionDTO questionDTO : listQuestionContentDTO ) {
++displayOrder;
if (StringUtils.equals(queContent.getQuestion(), questionDTO.getQuestion())) {
entryUsed = true;
@@ -492,11 +487,10 @@
if (entryUsed == false) {
- QaQueContent removeableQaQueContent = qaService.getQuestionContentByQuestionText(queContent
+ QaQuestion removeableQaQueContent = qaService.getQuestionContentByQuestionText(queContent
.getQuestion(), qaContent.getUid());
if (removeableQaQueContent != null) {
- // qaContent.getQaQueContents().remove(removeableQaQueContent);
- AuthoringUtil.logger.info("Removing question with id=" + removeableQaQueContent.getUid() + ", displayOrder=" + removeableQaQueContent.getDisplayOrder() + ", question=" + removeableQaQueContent.getQuestion());
+ //Removing question with id removeableQaQueContent.getUid()
qaService.removeQaQueContent(removeableQaQueContent);
}
@@ -507,21 +501,16 @@
}
/**
- * createQuestionContent(TreeMap mapQuestionContent, HttpServletRequest
- * request) return void
- *
* persist the questions in the Map the user has submitted
*
* LDEV-2526 note that questions have already been removed before this method is called, but
* their displayOrder fields haven't been updated yet. Note also that the given
* mapQuestionContent maps question numbers to question strings.
*/
- protected QaContent createQuestionContent(List listQuestionContentDTO, IQaService qaService,
+ protected QaContent createQuestionContent(List listQuestionContentDTO, IQaService qaService,
QaContent qaContent) {
- AuthoringUtil.logger.debug("createQuestionContent: content uid is: " + qaContent.getUid());
-
int displayOrder = 0;
- for ( QaQuestionContentDTO questionContentDTO : listQuestionContentDTO ) {
+ for ( QaQuestionDTO 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.
@@ -533,11 +522,11 @@
++displayOrder;
- QaQueContent existingQaQueContent = qaService.getQuestionContentByQuestionText(questionText, qaContent.getUid());
+ QaQuestion existingQaQueContent = qaService.getQuestionContentByQuestionText(questionText, qaContent.getUid());
if (existingQaQueContent == null) {
- QaQueContent queContent = new QaQueContent(questionText, displayOrder, questionContentDTO.getFeedback(),
- questionContentDTO.isRequired(), qaContent, null, null);
- qaContent.getQaQueContents().add(queContent);
+ QaQuestion queContent = new QaQuestion(questionText, displayOrder, questionContentDTO.getFeedback(),
+ questionContentDTO.isRequired(), qaContent, null);
+ qaContent.getQaQuestions().add(queContent);
queContent.setQaContent(qaContent);
AuthoringUtil.logger.info("Creating new question with question=" + queContent.getQuestion() + ", displayOrder=" + queContent.getDisplayOrder());
@@ -557,9 +546,9 @@
return qaContent;
}
- public static boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) {
+ public static boolean checkDuplicateQuestions(List listQuestionContentDTO, String newQuestion) {
AuthoringUtil.logger.debug("checkDuplicateQuestions: ");
- for (QaQuestionContentDTO questionDTO : listQuestionContentDTO ) {
+ for (QaQuestionDTO questionDTO : listQuestionContentDTO ) {
if ( questionDTO.getQuestion() != null && questionDTO.getQuestion().equals(newQuestion) ) {
return true;
}
@@ -568,9 +557,7 @@
}
/**
- * sorts the questions by the display order reOrganizeDisplayOrder(Map
- * mapQuestionContent, IQaService qaService, QaAuthoringForm
- * qaAuthoringForm, QaContent qaContent)
+ * sorts the questions by the display order
*
* @param mapQuestionContent
* @param qaService
@@ -580,26 +567,20 @@
public void reOrganizeDisplayOrder(IQaService qaService, QaAuthoringForm qaAuthoringForm,
QaContent qaContent) {
if (qaContent != null) {
- AuthoringUtil.logger.debug("content uid: " + qaContent.getUid());
List sortedQuestions = qaService.getAllQuestionEntriesSorted(qaContent.getUid().longValue());
Iterator listIterator = sortedQuestions.iterator();
int displayOrder = 1;
while (listIterator.hasNext()) {
- QaQueContent queContent = (QaQueContent) listIterator.next();
- AuthoringUtil.logger.debug("queContent: " + queContent.getQuestion() + " "
- + queContent.getDisplayOrder());
+ QaQuestion queContent = (QaQuestion) listIterator.next();
- QaQueContent existingQaQueContent = qaService.getQuestionContentByQuestionText(
+ QaQuestion existingQaQueContent = qaService.getQuestionContentByQuestionText(
queContent.getQuestion(), qaContent.getUid());
- AuthoringUtil.logger.debug("Changing the displayOrder from=" + existingQaQueContent.getDisplayOrder() + " to=" + displayOrder
- + " for existing question with id=" + existingQaQueContent.getUid() + ", contentId=" + existingQaQueContent.getQaContentId());
existingQaQueContent.setDisplayOrder(displayOrder);
qaService.saveOrUpdateQaQueContent(existingQaQueContent);
displayOrder++;
}
}
- AuthoringUtil.logger.debug("done with reOrganizeDisplayOrder...");
}
/**
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java (.../ClearSessionAction.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ClearSessionAction.java (.../ClearSessionAction.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -28,7 +28,6 @@
import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishAction;
import org.lamsfoundation.lams.tool.ToolAccessMode;
-import org.lamsfoundation.lams.web.util.AttributeNames;
/**
* This class give a chance to clear HttpSession when user save/close authoring
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java
===================================================================
diff -u -r30e23e6c8a61b69132c9b1883192554073911e21 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java (.../ExportServlet.java) (revision 30e23e6c8a61b69132c9b1883192554073911e21)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/ExportServlet.java (.../ExportServlet.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -30,14 +30,14 @@
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.tool.ToolAccessMode;
-import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
-import org.lamsfoundation.lams.tool.qa.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaQueUsr;
import org.lamsfoundation.lams.tool.qa.QaSession;
+import org.lamsfoundation.lams.tool.qa.dto.GeneralLearnerFlowDTO;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
+import org.lamsfoundation.lams.tool.qa.util.QaApplicationException;
import org.lamsfoundation.lams.tool.qa.util.QaBundler;
import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet;
@@ -89,7 +89,7 @@
IQaService service = QaServiceProxy.getQaService(getServletContext());
QaContent content = null;
if (toolContentID != null) {
- content = service.retrieveQa(toolContentID);
+ content = service.getQa(toolContentID);
} else {
QaSession session = service.retrieveQaSession(toolSessionID);
if (session != null)
@@ -103,29 +103,21 @@
}
public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) {
- logger.debug("starting learner mode...");
-
IQaService qaService = QaServiceProxy.getQaService(getServletContext());
- logger.debug("userID:" + userID);
- logger.debug("toolSessionID:" + toolSessionID);
-
if (userID == null || toolSessionID == null) {
String error = "Tool session Id or user Id is null. Unable to continue";
logger.error(error);
throw new QaApplicationException(error);
}
- QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue());
+ QaSession qaSession = qaService.getSessionById(toolSessionID.longValue());
// If the learner hasn't answered yet, then they won't exist in the session.
// Yet we might be asked for their page, as the activity has been commenced.
// So need to do a "blank" page in that case
- QaQueUsr learner = qaService.getQaUserBySession(userID, qaSession.getUid());
- logger.debug("UserID: " + learner.getUid());
-
+ QaQueUsr learner = qaService.getUserByIdAndSession(userID, qaSession.getQaSessionId());
QaContent content = qaSession.getQaContent();
- logger.debug("content id: " + content.getQaContentId());
if (content == null) {
String error = "The content for this activity has not been defined yet.";
@@ -138,7 +130,7 @@
logger.debug("start refreshSummaryData for learner mode.");
GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content);
- generalLearnerFlowDTO.setUserUid(learner != null ? learner.getUid().toString() : null);
+ generalLearnerFlowDTO.setUserUid(learner != null ? learner.getQueUsrId().toString() : null);
// if learner is null, don't want to show other people's answers
if (learner != null) {
@@ -170,7 +162,7 @@
throw new QaApplicationException(error);
}
- QaContent content = qaService.loadQa(toolContentID.longValue());
+ QaContent content = qaService.getQa(toolContentID.longValue());
if (content == null) {
String error = "Data is missing from the database. Unable to Continue";
@@ -184,8 +176,6 @@
GeneralLearnerFlowDTO generalLearnerFlowDTO = LearningUtil.buildGeneralLearnerFlowDTO(content);
qaMonitoringAction.refreshSummaryData(request, content, qaService, true, false, null, null,
generalLearnerFlowDTO, false, "All");
- logger.debug("end refreshSummaryData for teacher mode.");
- logger.debug("teacher uses content id: " + content.getQaContentId());
generalLearnerFlowDTO = (GeneralLearnerFlowDTO) request.getAttribute(GENERAL_LEARNER_FLOW_DTO);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -24,27 +24,27 @@
package org.lamsfoundation.lams.tool.qa.web;
import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
-import java.util.TreeSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
-import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
-import org.lamsfoundation.lams.tool.qa.QaComparator;
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.QaQuestion;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
-import org.lamsfoundation.lams.tool.qa.QaUtils;
+import org.lamsfoundation.lams.tool.qa.dto.GeneralLearnerFlowDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaQuestionDTO;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.util.QaComparator;
+import org.lamsfoundation.lams.tool.qa.web.form.QaLearningForm;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -60,8 +60,7 @@
static Logger logger = Logger.getLogger(LearningUtil.class.getName());
public static void saveFormRequestData(HttpServletRequest request, QaLearningForm qaLearningForm) {
- logger.debug("saving form request data...");
- String toolSessionID = request.getParameter("toolSessionID");
+ String toolSessionID = request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID);
qaLearningForm.setToolSessionID(toolSessionID);
String userID = request.getParameter("userID");
@@ -72,12 +71,9 @@
String totalQuestionCount = request.getParameter("totalQuestionCount");
qaLearningForm.setTotalQuestionCount(totalQuestionCount);
-
- logger.debug("done saving form request data.");
}
public static GeneralLearnerFlowDTO buildGeneralLearnerFlowDTO(QaContent qaContent) {
- logger.debug("starting buildMcGeneralLearnerFlowDTO: " + qaContent.getUid());
GeneralLearnerFlowDTO generalLearnerFlowDTO = new GeneralLearnerFlowDTO();
generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle());
generalLearnerFlowDTO.setActivityInstructions(qaContent.getInstructions());
@@ -94,157 +90,80 @@
generalLearnerFlowDTO.setAllowRichEditor(new Boolean(qaContent.isAllowRichEditor()).toString());
generalLearnerFlowDTO.setAllowRateAnswers(new Boolean(qaContent.isAllowRateAnswers()).toString());
- generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQueContents().size()));
+ generalLearnerFlowDTO.setTotalQuestionCount(new Integer(qaContent.getQaQuestions().size()));
- Map mapQuestions = new TreeMap();
-
- Iterator contentIterator = qaContent.getQaQueContents().iterator();
- while (contentIterator.hasNext()) {
- QaQueContent qaQueContent = (QaQueContent) contentIterator.next();
- if (qaQueContent != null) {
- int displayOrder = qaQueContent.getDisplayOrder();
- if (displayOrder != 0) {
- /*
- * add the question to the questions Map in the displayOrder
- */
- QaQuestionContentDTO questionDTO = new QaQuestionContentDTO(qaQueContent);
- mapQuestions.put(questionDTO.getDisplayOrder(), questionDTO );
- }
+ //create mapQuestions
+ Map mapQuestions = new TreeMap();
+ for (QaQuestion question : qaContent.getQaQuestions()) {
+ int displayOrder = question.getDisplayOrder();
+ if (displayOrder != 0) {
+ //add the question to the questions Map in the displayOrder
+ QaQuestionDTO questionDTO = new QaQuestionDTO(question);
+ mapQuestions.put(questionDTO.getDisplayOrder(), questionDTO);
}
}
-
generalLearnerFlowDTO.setMapQuestionContentLearner(mapQuestions);
+
return generalLearnerFlowDTO;
}
- /**
- * createUsersAndResponses(Map mapAnswers, HttpServletRequest request)
- * create users of the responses
- *
- * @param mapAnswers,
- * request return void
- *
- */
- protected void createUsersAndResponses(Map mapAnswers, HttpServletRequest request, IQaService qaService,
- Long toolContentID, Long toolSessionID) {
- logger.debug("toolContentID: " + toolContentID);
- logger.debug("toolSessionID: " + toolSessionID);
+// /**
+// * Create users of the responses
+// *
+// * @param mapAnswers
+// *
+// */
+// public static void storeResponses(Map mapAnswers, IQaService qaService, Long toolContentID, Long toolSessionID) {
+//
+// // get back login user DTO
+// HttpSession ss = SessionManager.getSession();
+// UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
+// Long userId = new Long(toolUser.getUserID().longValue());
+//
+// // obtain QaContent to be used in creating QaQueUsr
+// QaContent qaContent = qaService.getQa(toolContentID.longValue());
+//
+// QaQueUsr user = qaService.getUserByIdAndSession(userId, toolSessionID);
+//
+// // check if Attempt to Entry is allowed, if so create the responses
+// if (!user.isResponseFinalized() || !qaContent.isLockWhenFinished()) {
+//
+// Set questionsToStore;
+// if (qaContent.isQuestionsSequenced()) {
+// String currentQuestionIndex = qaLearningForm.getCurrentQuestionIndex();
+// QaQuestion currentQuestion = qaService.getQuestionContentByDisplayOrder(new Long(currentQuestionIndex), qaContent.getQaContentId());
+// questionsToStore = new LinkedHashSet();
+// questionsToStore.add(currentQuestion);
+//
+// } else {
+// questionsToStore = qaContent.getQaQuestions();
+// }
+//
+// for (QaQuestion question : questionsToStore) {
+//
+// String displayOrder = new Long(question.getDisplayOrder()).toString();
+// String answer = (String) mapAnswers.get(displayOrder);
+//
+// QaUsrResp response = qaService.getResponseByUserAndQuestion(user.getQueUsrId(), question.getUid());
+// // if response doesn't exist
+// if (response == null) {
+// response = new QaUsrResp(answer, new Date(System.currentTimeMillis()), "", question, user, true);
+// qaService.createQaUsrResp(response);
+//
+// //if answer has changed
+// } else if (! answer.equals(response.getAnswer())) {
+// response.setAnswer(answer);
+// response.setAttemptTime(new Date(System.currentTimeMillis()));
+// response.setTimezone("");
+// qaService.updateUserResponse(response);
+// }
+// }
+//
+// }
+// }
- HttpSession ss = SessionManager.getSession();
- /* get back login user DTO */
- UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
- logger.debug("retrieving toolUser userId: " + toolUser.getUserID());
-
- String userName = toolUser.getLogin();
- String fullName = toolUser.getFirstName() + " " + toolUser.getLastName();
-
- Long userId = new Long(toolUser.getUserID().longValue());
-
- /*
- * obtain QaContent to be used in creating QaQueUsr
- */
- QaContent qaContent = qaService.retrieveQa(toolContentID.longValue());
-
- QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue());
-
- Iterator contentIterator = qaContent.getQaQueContents().iterator();
-
- QaQueUsr qaQueUsr = new QaQueUsr(userId, userName, fullName, null, qaSession, new TreeSet());
-
-
- logger.debug("session uid: " + qaSession.getUid());
- /*note that it is possible for a user to already exist from another tool session. In this case don't add any more user record*/
- QaQueUsr qaQueUsrLocal = qaService.getQaUserBySession(userId, qaSession.getUid());
-
- if ((qaQueUsr != null) && (qaQueUsrLocal == null)) {
- qaQueUsr = createUser(request, toolSessionID, qaService);
- } else {
- qaQueUsr = qaQueUsrLocal;
- }
-
- boolean isResponseFinalized = qaQueUsr.isResponseFinalized();
-
- boolean lockWhenFinished = qaContent.isLockWhenFinished();
-
- boolean enableAttemptEntry = false;
- boolean userAttemptExist = false;
-
- if (!isResponseFinalized) {
- enableAttemptEntry = true;
- }
-
- if (isResponseFinalized && (!lockWhenFinished)) {
- userAttemptExist = true;
- enableAttemptEntry = true;
- }
-
- if (enableAttemptEntry) {
- logger.debug("enableAttemptEntry is true, so creating the responses: ");
- while (contentIterator.hasNext()) {
- QaQueContent qaQueContent = (QaQueContent) contentIterator.next();
- if (qaQueContent != null) {
-
- String displayOrder = new Long(qaQueContent.getDisplayOrder()).toString();
- String answer = (String) mapAnswers.get(displayOrder);
-
-
-
- String timezoneId = "";
-
- List attempts = qaService.getAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent
- .getUid());
-
- if (userAttemptExist) {
- qaService.removeAttemptsForUserAndQuestionContent(qaQueUsr.getUid(), qaQueContent.getUid());
-
- QaUsrResp qaUsrResp = new QaUsrResp(answer, false, new Date(System.currentTimeMillis()),
- timezoneId, qaQueContent, qaQueUsr, true);
-
- if (qaUsrResp != null) {
- qaService.createQaUsrResp(qaUsrResp);
- }
- } else {
- if ((attempts != null) && (attempts.size() > 0)) {
- } else {
- QaUsrResp qaUsrResp = new QaUsrResp(answer, false, new Date(System.currentTimeMillis()),
- timezoneId, qaQueContent, qaQueUsr, true);
-
- if (qaUsrResp != null) {
- qaService.createQaUsrResp(qaUsrResp);
- }
- }
- }
- }
- }
-
- }
- if (qaQueUsr != null) {
- qaQueUsr.setResponseFinalized(true);
- logger.debug("finalized user input");
- qaService.updateQaQueUsr(qaQueUsr);
- }
- }
-
- public static QaQueUsr createUser(HttpServletRequest request, Long toolSessionID, IQaService qaService) {
- logger.debug("creating a new user in the tool db, toolSessionID: " + toolSessionID);
-
- Long queUsrId = QaUtils.getUserId();
- String username = QaUtils.getUserName();
- String fullname = QaUtils.getUserFullName();
-
- QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionID.longValue());
-
- QaQueUsr qaQueUsr = new QaQueUsr(queUsrId, username, fullname, null, qaSession, new TreeSet());
-
- qaService.createQaQueUsr(qaQueUsr);
- return qaQueUsr;
- }
-
- protected String getRemainingQuestionCount(int currentQuestionIndex, String totalQuestionCount) {
- logger.debug("totalQuestionCount: " + totalQuestionCount);
+ public static String getRemainingQuestionCount(int currentQuestionIndex, String totalQuestionCount) {
int remainingQuestionCount = new Long(totalQuestionCount).intValue() - currentQuestionIndex + 1;
- logger.debug("remainingQuestionCount: " + remainingQuestionCount);
-
return new Integer(remainingQuestionCount).toString();
}
@@ -255,26 +174,54 @@
* @param qaLearningForm
* return void
*/
- protected String feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex,
+ public static String feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex,
String totalQuestionCount) {
- logger.debug("totalQuestionCount: " + totalQuestionCount);
int remainingQuestionCount = new Long(totalQuestionCount).intValue() - currentQuestionIndex + 1;
- logger.debug("remainingQuestionCount: " + remainingQuestionCount);
String userFeedback = "";
- if (remainingQuestionCount != 0)
+ if (remainingQuestionCount != 0) {
userFeedback = "Remaining question count: " + remainingQuestionCount;
- else
+ } else {
userFeedback = "End of the questions.";
+ }
return userFeedback;
}
-
- public void setContentInUse(long toolContentID, IQaService qaService) {
- QaContent qaContent = qaService.loadQa(toolContentID);
-
- qaContent.setContentLocked(true);
- logger.debug("content with id : " + toolContentID + "has been marked LOCKED");
- qaService.updateQa(qaContent);
- logger.debug("content with id : " + toolContentID + "has been marked LOCKED and updated in the db");
+
+ /**
+ */
+ public static void populateAnswers(Map sessionMap, QaContent qaContent, QaQueUsr qaQueUsr,
+ Map mapQuestions, GeneralLearnerFlowDTO generalLearnerFlowDTO,
+ IQaService qaService) {
+
+ //create mapAnswers
+ Map mapAnswers = (Map) sessionMap.get(MAP_ALL_RESULTS_KEY);
+ if (mapAnswers == null) {
+ mapAnswers = new TreeMap(new QaComparator());
+
+ // get responses from DB
+ Map mapAnswersFromDb = new TreeMap();
+ for (QaQuestion question : qaContent.getQaQuestions()) {
+ Long questionUid = question.getUid();
+ QaUsrResp dbResponse = qaService.getResponseByUserAndQuestion(qaQueUsr.getQueUsrId(), questionUid);
+ if (dbResponse != null) {
+ mapAnswersFromDb.put(String.valueOf(question.getDisplayOrder()), dbResponse.getAnswer());
+ }
+ }
+
+ // maybe we have come in from the review screen, if so get the answers from db.
+ if (mapAnswersFromDb.size() > 0) {
+ mapAnswers.putAll(mapAnswersFromDb);
+ } else {
+ for (Map.Entry pairs : mapQuestions.entrySet()) {
+ mapAnswers.put(pairs.getKey().toString(), "");
+ }
+ }
+ }
+ String currentAnswer = (String) mapAnswers.get("1");
+ generalLearnerFlowDTO.setCurrentQuestionIndex(new Integer(1));
+ generalLearnerFlowDTO.setCurrentAnswer(currentAnswer);
+ sessionMap.put(MAP_SEQUENTIAL_ANSWERS_KEY, mapAnswers);
+ generalLearnerFlowDTO.setMapAnswers(mapAnswers);
+ sessionMap.put(MAP_ALL_RESULTS_KEY, mapAnswers);
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java
===================================================================
diff -u -r2a3012f2276337d5f3b2e7eb2a30acc2d4af4176 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 2a3012f2276337d5f3b2e7eb2a30acc2d4af4176)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -35,20 +35,20 @@
import org.apache.log4j.Logger;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
-import org.lamsfoundation.lams.tool.qa.QaAllGroupsDTO;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
import org.lamsfoundation.lams.tool.qa.QaContent;
-import org.lamsfoundation.lams.tool.qa.QaMonitoredAnswersDTO;
-import org.lamsfoundation.lams.tool.qa.QaMonitoredUserDTO;
-import org.lamsfoundation.lams.tool.qa.QaQueContent;
import org.lamsfoundation.lams.tool.qa.QaQueUsr;
+import org.lamsfoundation.lams.tool.qa.QaQuestion;
import org.lamsfoundation.lams.tool.qa.QaSession;
-import org.lamsfoundation.lams.tool.qa.QaStatsDTO;
-import org.lamsfoundation.lams.tool.qa.QaStringComparator;
import org.lamsfoundation.lams.tool.qa.QaUsrResp;
-import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.dto.AverageRatingDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaAllGroupsDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaMonitoredAnswersDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaMonitoredUserDTO;
+import org.lamsfoundation.lams.tool.qa.dto.QaStatsDTO;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
+import org.lamsfoundation.lams.tool.qa.util.QaStringComparator;
+import org.lamsfoundation.lams.tool.qa.util.QaUtils;
/**
*
@@ -61,123 +61,46 @@
static Logger logger = Logger.getLogger(MonitoringUtil.class.getName());
/**
- * determine whether all the tool sessions for a particular content has been
- * COMPLETED boolean isSessionsSync(HttpServletRequest request, long
- * toolContentId)
- *
- * @param toolContentId
- * @return boolean
- */
- public boolean isSessionsSync(QaContent qaContent) {
- /*
- * iterate all the tool sessions, if even one session is INCOMPLETE, the function returns false
- */
- if (qaContent != null) {
- Iterator sessionIterator = qaContent.getQaSessions().iterator();
- while (sessionIterator.hasNext()) {
- QaSession qaSession = (QaSession) sessionIterator.next();
- if (qaSession.getSession_status().equalsIgnoreCase(QaSession.INCOMPLETE))
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * updateResponse(HttpServletRequest request, String responseId, String
- * updatedResponse)
- *
- * @param qaService
- * @param responseId
- * @param updatedResponse
- */
- public void updateResponse(IQaService qaService, String responseId, String updatedResponse) {
- logger.debug("load response with responseId: " + new Long(responseId).longValue());
- QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue());
- qaUsrResp.setAnswer(updatedResponse);
- qaService.updateQaUsrResp(qaUsrResp);
- }
-
- /**
- * hideResponse(HttpServletRequest request, String responseId)
- *
- * @param qaService
- * @param responseId
- */
- public void hideResponse(IQaService qaService, String responseId) {
- logger.debug("load response with responseId for hiding: " + new Long(responseId).longValue());
- QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue());
- qaUsrResp.setHidden(true);
- qaService.updateQaUsrResp(qaUsrResp);
- }
-
- /**
- * unHideResponse(HttpServletRequest request, String responseId)
- *
- * @param request
- * @param responseId
- */
- public void unHideResponse(IQaService qaService, String responseId) {
- logger.debug("load response with responseId for un-hiding: " + new Long(responseId).longValue());
- QaUsrResp qaUsrResp = qaService.retrieveQaUsrResp(new Long(responseId).longValue());
- qaUsrResp.setHidden(false);
- qaService.updateQaUsrResp(qaUsrResp);
- }
-
- /**
* populates all the tool sessions in a map
- * populateToolSessions(HttpServletRequest request, McContent mcContent)
*
* @param request
* @param mcContent
* @return Map
*/
public static Map populateToolSessions(HttpServletRequest request, QaContent qaContent, IQaService qaService) {
List sessionsList = qaService.getSessionNamesFromContent(qaContent);
- logger.debug("sessionsList size is:..." + sessionsList.size());
-
+
Map sessionsMap = QaUtils.convertToStringMap(sessionsList, "String");
-
if (sessionsMap.isEmpty()) {
- logger.debug("sessionsMap size is 0:");
sessionsMap.put(new Long(1).toString(), "None");
} else {
- logger.debug("sessionsMap has some entries: " + sessionsMap.size());
sessionsMap.put(new Long(sessionsMap.size() + 1).toString(), "All");
}
return sessionsMap;
}
/**
* populates all the tool sessions in a map
- * populateToolSessions(HttpServletRequest request, McContent mcContent)
*
* @param request
* @param mcContent
* @return Map
*/
public static Map populateToolSessionsId(HttpServletRequest request, QaContent qaContent, IQaService qaService) {
List sessionsList = qaService.getSessionsFromContent(qaContent);
- logger.debug("sessionsList size is:..." + sessionsList.size());
Map sessionsMap = QaUtils.convertToStringMap(sessionsList, "Long");
- logger.debug("sessionsMap size:..." + sessionsMap.size());
-
if (sessionsMap.isEmpty()) {
- logger.debug("sessionsMap size is 0:");
sessionsMap.put(new Long(1).toString(), "None");
} else {
- logger.debug("sessionsMap has some entries: " + sessionsMap.size());
sessionsMap.put(new Long(sessionsMap.size() + 1).toString(), "All");
}
return sessionsMap;
}
/**
* ends up populating the attempt history for all the users of all the tool
- * sessions for a content buildGroupsQuestionData(HttpServletRequest
- * request, McContent mcContent)
+ * sessions for a content
*
* User id is needed if isUserNamesVisible is false && is learnerRequest =
* true, as it is required to work out if the data being analysed is the
@@ -189,14 +112,11 @@
*/
public static List buildGroupsQuestionData(HttpServletRequest request, QaContent qaContent, IQaService qaService,
boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId) {
- logger.debug("buildGroupsQuestionData: " + currentSessionId);
-
List listQuestions = qaService.getAllQuestionEntries(qaContent.getUid());
String sessionName = "";
if ((currentSessionId != null) && (!currentSessionId.equals("All"))) {
- QaSession qaSession = qaService.retrieveQaSessionOrNullById(new Long(currentSessionId).longValue());
-
+ QaSession qaSession = qaService.getSessionById(new Long(currentSessionId).longValue());
sessionName = qaSession.getSession_name();
}
request.setAttribute(CURRENT_SESSION_NAME, sessionName);
@@ -205,18 +125,17 @@
Iterator itListQuestions = listQuestions.iterator();
while (itListQuestions.hasNext()) {
- QaQueContent qaQueContent = (QaQueContent) itListQuestions.next();
+ QaQuestion qaQuestion = (QaQuestion) itListQuestions.next();
- if (qaQueContent != null) {
+ if (qaQuestion != null) {
QaMonitoredAnswersDTO qaMonitoredAnswersDTO = new QaMonitoredAnswersDTO();
- qaMonitoredAnswersDTO.setQuestionUid(qaQueContent.getUid().toString());
- qaMonitoredAnswersDTO.setQuestion(qaQueContent.getQuestion());
- qaMonitoredAnswersDTO.setFeedback(qaQueContent.getFeedback());
+ qaMonitoredAnswersDTO.setQuestionUid(qaQuestion.getUid().toString());
+ qaMonitoredAnswersDTO.setQuestion(qaQuestion.getQuestion());
+ qaMonitoredAnswersDTO.setFeedback(qaQuestion.getFeedback());
qaMonitoredAnswersDTO.setSessionName(sessionName);
- logger.debug("using allUsersData to retrieve users data: " + isUserNamesVisible);
- Map questionAttemptData = buildGroupsAttemptData(request, qaContent, qaService, qaQueContent,
- qaQueContent.getUid().toString(), isUserNamesVisible, isLearnerRequest, currentSessionId,
+ Map questionAttemptData = buildGroupsAttemptData(request, qaContent, qaService,
+ qaQuestion.getUid().toString(), isUserNamesVisible, isLearnerRequest, currentSessionId,
userId);
qaMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData);
listMonitoredAnswersContainerDTO.add(qaMonitoredAnswersDTO);
@@ -232,13 +151,10 @@
* or to work out which is the user's answers (for not show all answers).
*/
public static Map buildGroupsAttemptData(HttpServletRequest request, QaContent qaContent, IQaService qaService,
- QaQueContent qaQueContent, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest,
- String currentSessionId, String userId) {
- logger.debug("doing buildGroupsAttemptData...");
+ String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId,
+ String userId) {
+ List
-
+
Index: lams_tool_laqa/web/WEB-INF/struts-config.xml
===================================================================
diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
+++ lams_tool_laqa/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -13,13 +13,13 @@
-
-
-
-
-
+
+
+
+
+
-
+
Index: lams_tool_laqa/web/includes/javascript/jquery.blockUI.js
===================================================================
diff -u
--- lams_tool_laqa/web/includes/javascript/jquery.blockUI.js (revision 0)
+++ lams_tool_laqa/web/includes/javascript/jquery.blockUI.js (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,490 @@
+/*!
+ * jQuery blockUI plugin
+ * Version 2.37 (29-JAN-2011)
+ * @requires jQuery v1.2.3 or later
+ *
+ * Examples at: http://malsup.com/jquery/block/
+ * Copyright (c) 2007-2010 M. Alsup
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
+ */
+
+;(function($) {
+
+if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
+ alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
+ return;
+}
+
+$.fn._fadeIn = $.fn.fadeIn;
+
+var noOp = function() {};
+
+// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
+// retarded userAgent strings on Vista)
+var mode = document.documentMode || 0;
+var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;
+
+// global $ methods for blocking/unblocking the entire page
+$.blockUI = function(opts) { install(window, opts); };
+$.unblockUI = function(opts) { remove(window, opts); };
+
+// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
+$.growlUI = function(title, message, timeout, onClose) {
+ var $m = $('');
+ if (title) $m.append('
'+title+'
');
+ if (message) $m.append('
'+message+'
');
+ if (timeout == undefined) timeout = 3000;
+ $.blockUI({
+ message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
+ timeout: timeout, showOverlay: false,
+ onUnblock: onClose,
+ css: $.blockUI.defaults.growlCSS
+ });
+};
+
+// plugin method for blocking element content
+$.fn.block = function(opts) {
+ return this.unblock({ fadeOut: 0 }).each(function() {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ if ($.browser.msie)
+ this.style.zoom = 1; // force 'hasLayout'
+ install(this, opts);
+ });
+};
+
+// plugin method for unblocking element content
+$.fn.unblock = function(opts) {
+ return this.each(function() {
+ remove(this, opts);
+ });
+};
+
+$.blockUI.version = 2.37; // 2nd generation blocking at no extra cost!
+
+// override these in your code to change the default behavior and style
+$.blockUI.defaults = {
+ // message displayed when blocking (use null for no message)
+ message: '
Please wait...
',
+
+ title: null, // title string; only used when theme == true
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
+
+ theme: false, // set to true to use with jQuery UI themes
+
+ // styles for the message when blocking; if you wish to disable
+ // these and use an external stylesheet then do this in your code:
+ // $.blockUI.defaults.css = {};
+ css: {
+ padding: 0,
+ margin: 0,
+ width: '30%',
+ top: '40%',
+ left: '35%',
+ textAlign: 'center',
+ color: '#000',
+ border: '3px solid #aaa',
+ backgroundColor:'#fff',
+ cursor: 'wait'
+ },
+
+ // minimal style set used when themes are used
+ themedCSS: {
+ width: '30%',
+ top: '40%',
+ left: '35%'
+ },
+
+ // styles for the overlay
+ overlayCSS: {
+ backgroundColor: '#000',
+ opacity: 0.6,
+ cursor: 'wait'
+ },
+
+ // styles applied when using $.growlUI
+ growlCSS: {
+ width: '350px',
+ top: '10px',
+ left: '',
+ right: '10px',
+ border: 'none',
+ padding: '5px',
+ opacity: 0.6,
+ cursor: 'default',
+ color: '#fff',
+ backgroundColor: '#000',
+ '-webkit-border-radius': '10px',
+ '-moz-border-radius': '10px',
+ 'border-radius': '10px'
+ },
+
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
+ // (hat tip to Jorge H. N. de Vasconcelos)
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
+
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
+ forceIframe: false,
+
+ // z-index for the blocking overlay
+ baseZ: 1000,
+
+ // set these to true to have the message automatically centered
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
+ centerY: true,
+
+ // allow body element to be stetched in ie6; this makes blocking look better
+ // on "short" pages. disable if you wish to prevent changes to the body height
+ allowBodyStretch: true,
+
+ // enable if you want key and mouse events to be disabled for content that is blocked
+ bindEvents: true,
+
+ // be default blockUI will supress tab navigation from leaving blocking content
+ // (if bindEvents is true)
+ constrainTabKey: true,
+
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
+ fadeIn: 200,
+
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
+ fadeOut: 400,
+
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
+ timeout: 0,
+
+ // disable if you don't want to show the overlay
+ showOverlay: true,
+
+ // if true, focus will be placed in the first available input field when
+ // page blocking
+ focusInput: true,
+
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
+ applyPlatformOpacityRules: true,
+
+ // callback method invoked when fadeIn has completed and blocking message is visible
+ onBlock: null,
+
+ // callback method invoked when unblocking has completed; the callback is
+ // passed the element that has been unblocked (which is the window object for page
+ // blocks) and the options that were passed to the unblock call:
+ // onUnblock(element, options)
+ onUnblock: null,
+
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
+ quirksmodeOffsetHack: 4,
+
+ // class name of the message block
+ blockMsgClass: 'blockMsg'
+};
+
+// private data and functions follow...
+
+var pageBlock = null;
+var pageBlockEls = [];
+
+function install(el, opts) {
+ var full = (el == window);
+ var msg = opts && opts.message !== undefined ? opts.message : undefined;
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
+ var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
+ var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
+ msg = msg === undefined ? opts.message : msg;
+
+ // remove the current block (if there is one)
+ if (full && pageBlock)
+ remove(window, {fadeOut:0});
+
+ // if an existing element is being used as the blocking content then we capture
+ // its current place in the DOM (and current display style) so we can restore
+ // it when we unblock
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
+ var node = msg.jquery ? msg[0] : msg;
+ var data = {};
+ $(el).data('blockUI.history', data);
+ data.el = node;
+ data.parent = node.parentNode;
+ data.display = node.style.display;
+ data.position = node.style.position;
+ if (data.parent)
+ data.parent.removeChild(node);
+ }
+
+ var z = opts.baseZ;
+
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
+ // layer3 is the message content that is displayed while blocking
+
+ var lyr1 = ($.browser.msie || opts.forceIframe)
+ ? $('')
+ : $('');
+ var lyr2 = $('');
+
+ var lyr3, s;
+ if (opts.theme && full) {
+ s = '
' +
+ '
'+(opts.title || ' ')+'
' +
+ '' +
+ '
';
+ }
+ else if (opts.theme) {
+ s = '
' +
+ '
'+(opts.title || ' ')+'
' +
+ '' +
+ '
';
+ }
+ else if (full) {
+ s = '';
+ }
+ else {
+ s = '';
+ }
+ lyr3 = $(s);
+
+ // if we have a message, style it
+ if (msg) {
+ if (opts.theme) {
+ lyr3.css(themedCSS);
+ lyr3.addClass('ui-widget-content');
+ }
+ else
+ lyr3.css(css);
+ }
+
+ // style the overlay
+ if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
+ lyr2.css(opts.overlayCSS);
+ lyr2.css('position', full ? 'fixed' : 'absolute');
+
+ // make iframe layer transparent in IE
+ if ($.browser.msie || opts.forceIframe)
+ lyr1.css('opacity',0.0);
+
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
+ $.each(layers, function() {
+ this.appendTo($par);
+ });
+
+ if (opts.theme && opts.draggable && $.fn.draggable) {
+ lyr3.draggable({
+ handle: '.ui-dialog-titlebar',
+ cancel: 'li'
+ });
+ }
+
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
+ var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
+ if (ie6 || expr) {
+ // give body 100% height
+ if (full && opts.allowBodyStretch && $.boxModel)
+ $('html,body').css('height','100%');
+
+ // fix ie6 issue when blocked element has a border width
+ if ((ie6 || !$.boxModel) && !full) {
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
+ var fixT = t ? '(0 - '+t+')' : 0;
+ var fixL = l ? '(0 - '+l+')' : 0;
+ }
+
+ // simulate fixed position
+ $.each([lyr1,lyr2,lyr3], function(i,o) {
+ var s = o[0].style;
+ s.position = 'absolute';
+ if (i < 2) {
+ full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
+ : s.setExpression('height','this.parentNode.offsetHeight + "px"');
+ full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
+ : s.setExpression('width','this.parentNode.offsetWidth + "px"');
+ if (fixL) s.setExpression('left', fixL);
+ if (fixT) s.setExpression('top', fixT);
+ }
+ else if (opts.centerY) {
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
+ s.marginTop = 0;
+ }
+ else if (!opts.centerY && full) {
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
+ s.setExpression('top',expression);
+ }
+ });
+ }
+
+ // show the message
+ if (msg) {
+ if (opts.theme)
+ lyr3.find('.ui-widget-content').append(msg);
+ else
+ lyr3.append(msg);
+ if (msg.jquery || msg.nodeType)
+ $(msg).show();
+ }
+
+ if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
+ lyr1.show(); // opacity is zero
+ if (opts.fadeIn) {
+ var cb = opts.onBlock ? opts.onBlock : noOp;
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
+ var cb2 = msg ? cb : noOp;
+ if (opts.showOverlay)
+ lyr2._fadeIn(opts.fadeIn, cb1);
+ if (msg)
+ lyr3._fadeIn(opts.fadeIn, cb2);
+ }
+ else {
+ if (opts.showOverlay)
+ lyr2.show();
+ if (msg)
+ lyr3.show();
+ if (opts.onBlock)
+ opts.onBlock();
+ }
+
+ // bind key and mouse events
+ bind(1, el, opts);
+
+ if (full) {
+ pageBlock = lyr3[0];
+ pageBlockEls = $(':input:enabled:visible',pageBlock);
+ if (opts.focusInput)
+ setTimeout(focus, 20);
+ }
+ else
+ center(lyr3[0], opts.centerX, opts.centerY);
+
+ if (opts.timeout) {
+ // auto-unblock
+ var to = setTimeout(function() {
+ full ? $.unblockUI(opts) : $(el).unblock(opts);
+ }, opts.timeout);
+ $(el).data('blockUI.timeout', to);
+ }
+};
+
+// remove the block
+function remove(el, opts) {
+ var full = (el == window);
+ var $el = $(el);
+ var data = $el.data('blockUI.history');
+ var to = $el.data('blockUI.timeout');
+ if (to) {
+ clearTimeout(to);
+ $el.removeData('blockUI.timeout');
+ }
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
+ bind(0, el, opts); // unbind events
+
+ var els;
+ if (full) // crazy selector to handle odd field errors in ie6/7
+ els = $('body').children().filter('.blockUI').add('body > .blockUI');
+ else
+ els = $('.blockUI', el);
+
+ if (full)
+ pageBlock = pageBlockEls = null;
+
+ if (opts.fadeOut) {
+ els.fadeOut(opts.fadeOut);
+ setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);
+ }
+ else
+ reset(els, data, opts, el);
+};
+
+// move blocking element back into the DOM where it started
+function reset(els,data,opts,el) {
+ els.each(function(i,o) {
+ // remove via DOM calls so we don't lose event handlers
+ if (this.parentNode)
+ this.parentNode.removeChild(this);
+ });
+
+ if (data && data.el) {
+ data.el.style.display = data.display;
+ data.el.style.position = data.position;
+ if (data.parent)
+ data.parent.appendChild(data.el);
+ $(el).removeData('blockUI.history');
+ }
+
+ if (typeof opts.onUnblock == 'function')
+ opts.onUnblock(el,opts);
+};
+
+// bind/unbind the handler
+function bind(b, el, opts) {
+ var full = el == window, $el = $(el);
+
+ // don't bother unbinding if there is nothing to unbind
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
+ return;
+ if (!full)
+ $el.data('blockUI.isBlocked', b);
+
+ // don't bind events when overlay is not in use or if bindEvents is false
+ if (!opts.bindEvents || (b && !opts.showOverlay))
+ return;
+
+ // bind anchors and inputs for mouse and key events
+ var events = 'mousedown mouseup keydown keypress';
+ b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);
+
+// former impl...
+// var $e = $('a,:input');
+// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
+};
+
+// event handler to suppress keyboard/mouse events when blocking
+function handler(e) {
+ // allow tab navigation (conditionally)
+ if (e.keyCode && e.keyCode == 9) {
+ if (pageBlock && e.data.constrainTabKey) {
+ var els = pageBlockEls;
+ var fwd = !e.shiftKey && e.target === els[els.length-1];
+ var back = e.shiftKey && e.target === els[0];
+ if (fwd || back) {
+ setTimeout(function(){focus(back)},10);
+ return false;
+ }
+ }
+ }
+ var opts = e.data;
+ // allow events within the message content
+ if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
+ return true;
+
+ // allow events for content that is not being blocked
+ return $(e.target).parents().children().filter('div.blockUI').length == 0;
+};
+
+function focus(back) {
+ if (!pageBlockEls)
+ return;
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
+ if (e)
+ e.focus();
+};
+
+function center(el, x, y) {
+ var p = el.parentNode, s = el.style;
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
+ if (x) s.left = l > 0 ? (l+'px') : '0';
+ if (y) s.top = t > 0 ? (t+'px') : '0';
+};
+
+function sz(el, p) {
+ return parseInt($.css(el,p))||0;
+};
+
+})(jQuery);
\ No newline at end of file
Index: lams_tool_laqa/web/includes/javascript/jquery.form.js
===================================================================
diff -u
--- lams_tool_laqa/web/includes/javascript/jquery.form.js (revision 0)
+++ lams_tool_laqa/web/includes/javascript/jquery.form.js (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -0,0 +1,803 @@
+/*!
+ * jQuery Form Plugin
+ * version: 2.65 (09-MAR-2011)
+ * @requires jQuery v1.3.2 or later
+ *
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+;(function($) {
+
+/*
+ Usage Note:
+ -----------
+ Do not use both ajaxSubmit and ajaxForm on the same form. These
+ functions are intended to be exclusive. Use ajaxSubmit if you want
+ to bind your own submit handler to the form. For example,
+
+ $(document).ready(function() {
+ $('#myForm').bind('submit', function(e) {
+ e.preventDefault(); // <-- important
+ $(this).ajaxSubmit({
+ target: '#output'
+ });
+ });
+ });
+
+ Use ajaxForm when you want the plugin to manage all the event binding
+ for you. For example,
+
+ $(document).ready(function() {
+ $('#myForm').ajaxForm({
+ target: '#output'
+ });
+ });
+
+ When using ajaxForm, the ajaxSubmit function will be invoked for you
+ at the appropriate time.
+*/
+
+/**
+ * ajaxSubmit() provides a mechanism for immediately submitting
+ * an HTML form using AJAX.
+ */
+$.fn.ajaxSubmit = function(options) {
+ // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+ if (!this.length) {
+ log('ajaxSubmit: skipping submit process - no element selected');
+ return this;
+ }
+
+ if (typeof options == 'function') {
+ options = { success: options };
+ }
+
+ var action = this.attr('action');
+ var url = (typeof action === 'string') ? $.trim(action) : '';
+ if (url) {
+ // clean url (don't include hash vaue)
+ url = (url.match(/^([^#]+)/)||[])[1];
+ }
+ url = url || window.location.href || '';
+
+ options = $.extend(true, {
+ url: url,
+ type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
+ }, options);
+
+ // hook for manipulating the form data before it is extracted;
+ // convenient for use with rich editors like tinyMCE or FCKEditor
+ var veto = {};
+ this.trigger('form-pre-serialize', [this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
+ return this;
+ }
+
+ // provide opportunity to alter form data before it is serialized
+ if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSerialize callback');
+ return this;
+ }
+
+ var n,v,a = this.formToArray(options.semantic);
+ if (options.data) {
+ options.extraData = options.data;
+ for (n in options.data) {
+ if(options.data[n] instanceof Array) {
+ for (var k in options.data[n]) {
+ a.push( { name: n, value: options.data[n][k] } );
+ }
+ }
+ else {
+ v = options.data[n];
+ v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
+ a.push( { name: n, value: v } );
+ }
+ }
+ }
+
+ // give pre-submit callback an opportunity to abort the submit
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
+ log('ajaxSubmit: submit aborted via beforeSubmit callback');
+ return this;
+ }
+
+ // fire vetoable 'validate' event
+ this.trigger('form-submit-validate', [a, this, options, veto]);
+ if (veto.veto) {
+ log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
+ return this;
+ }
+
+ var q = $.param(a);
+
+ if (options.type.toUpperCase() == 'GET') {
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+ options.data = null; // data is null for 'get'
+ }
+ else {
+ options.data = q; // data is the query string for 'post'
+ }
+
+ var $form = this, callbacks = [];
+ if (options.resetForm) {
+ callbacks.push(function() { $form.resetForm(); });
+ }
+ if (options.clearForm) {
+ callbacks.push(function() { $form.clearForm(); });
+ }
+
+ // perform a load on the target only if dataType is not provided
+ if (!options.dataType && options.target) {
+ var oldSuccess = options.success || function(){};
+ callbacks.push(function(data) {
+ var fn = options.replaceTarget ? 'replaceWith' : 'html';
+ $(options.target)[fn](data).each(oldSuccess, arguments);
+ });
+ }
+ else if (options.success) {
+ callbacks.push(options.success);
+ }
+
+ options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
+ var context = options.context || options; // jQuery 1.4+ supports scope context
+ for (var i=0, max=callbacks.length; i < max; i++) {
+ callbacks[i].apply(context, [data, status, xhr || $form, $form]);
+ }
+ };
+
+ // are there files to upload?
+ var fileInputs = $('input:file', this).length > 0;
+ var mp = 'multipart/form-data';
+ var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
+
+ // options.iframe allows user to force iframe mode
+ // 06-NOV-09: now defaulting to iframe mode if file input is detected
+ if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
+ // hack to fix Safari hang (thanks to Tim Molendijk for this)
+ // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+ if (options.closeKeepAlive) {
+ $.get(options.closeKeepAlive, fileUpload);
+ }
+ else {
+ fileUpload();
+ }
+ }
+ else {
+ $.ajax(options);
+ }
+
+ // fire 'notify' event
+ this.trigger('form-submit-notify', [this, options]);
+ return this;
+
+
+ // private function for handling file uploads (hat tip to YAHOO!)
+ function fileUpload() {
+ var form = $form[0];
+
+ if ($(':input[name=submit],:input[id=submit]', form).length) {
+ // if there is an input with a name or id of 'submit' then we won't be
+ // able to invoke the submit fn on the form (at least not x-browser)
+ alert('Error: Form elements must not have name or id of "submit".');
+ return;
+ }
+
+ var s = $.extend(true, {}, $.ajaxSettings, options);
+ s.context = s.context || s;
+ var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
+ var $io = $('');
+ var io = $io[0];
+
+ $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+
+ var xhr = { // mock object
+ aborted: 0,
+ responseText: null,
+ responseXML: null,
+ status: 0,
+ statusText: 'n/a',
+ getAllResponseHeaders: function() {},
+ getResponseHeader: function() {},
+ setRequestHeader: function() {},
+ abort: function() {
+ this.aborted = 1;
+ $io.attr('src', s.iframeSrc); // abort op in progress
+ }
+ };
+
+ var g = s.global;
+ // trigger ajax global events so that activity/block indicators work like normal
+ if (g && ! $.active++) {
+ $.event.trigger("ajaxStart");
+ }
+ if (g) {
+ $.event.trigger("ajaxSend", [xhr, s]);
+ }
+
+ if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
+ if (s.global) {
+ $.active--;
+ }
+ return;
+ }
+ if (xhr.aborted) {
+ return;
+ }
+
+ var timedOut = 0;
+
+ // add submitting element to data if we know it
+ var sub = form.clk;
+ if (sub) {
+ var n = sub.name;
+ if (n && !sub.disabled) {
+ s.extraData = s.extraData || {};
+ s.extraData[n] = sub.value;
+ if (sub.type == "image") {
+ s.extraData[n+'.x'] = form.clk_x;
+ s.extraData[n+'.y'] = form.clk_y;
+ }
+ }
+ }
+
+ // take a breath so that pending repaints get some cpu time before the upload starts
+ function doSubmit() {
+ // make sure form attrs are set
+ var t = $form.attr('target'), a = $form.attr('action');
+
+ // update form attrs in IE friendly way
+ form.setAttribute('target',id);
+ if (form.getAttribute('method') != 'POST') {
+ form.setAttribute('method', 'POST');
+ }
+ if (form.getAttribute('action') != s.url) {
+ form.setAttribute('action', s.url);
+ }
+
+ // ie borks in some cases when setting encoding
+ if (! s.skipEncodingOverride) {
+ $form.attr({
+ encoding: 'multipart/form-data',
+ enctype: 'multipart/form-data'
+ });
+ }
+
+ // support timout
+ if (s.timeout) {
+ setTimeout(function() { timedOut = true; cb(); }, s.timeout);
+ }
+
+ // add "extra" data to form if provided in options
+ var extraInputs = [];
+ try {
+ if (s.extraData) {
+ for (var n in s.extraData) {
+ extraInputs.push(
+ $('')
+ .appendTo(form)[0]);
+ }
+ }
+
+ // add iframe to doc and submit the form
+ $io.appendTo('body');
+ io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+ form.submit();
+ }
+ finally {
+ // reset attrs and remove "extra" input elements
+ form.setAttribute('action',a);
+ if(t) {
+ form.setAttribute('target', t);
+ } else {
+ $form.removeAttr('target');
+ }
+ $(extraInputs).remove();
+ }
+ }
+
+ if (s.forceSync) {
+ doSubmit();
+ }
+ else {
+ setTimeout(doSubmit, 10); // this lets dom updates render
+ }
+
+ var data, doc, domCheckCount = 50;
+
+ function cb() {
+ doc = io.document ? io.document : io.contentWindow ? io.contentWindow.document : io.contentDocument;
+ if (!doc || doc.location.href == s.iframeSrc) {
+ // response not received yet
+ return;
+ }
+ io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
+
+ var ok = true;
+ try {
+ if (timedOut) {
+ throw 'timeout';
+ }
+
+ var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
+ log('isXml='+isXml);
+ if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
+ if (--domCheckCount) {
+ // in some browsers (Opera) the iframe DOM is not always traversable when
+ // the onload callback fires, so we loop a bit to accommodate
+ log('requeing onLoad callback, DOM not available');
+ setTimeout(cb, 250);
+ return;
+ }
+ // let this fall through because server response could be an empty document
+ //log('Could not access iframe DOM after mutiple tries.');
+ //throw 'DOMException: not available';
+ }
+
+ //log('response detected');
+ xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
+ xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+ xhr.getResponseHeader = function(header){
+ var headers = {'content-type': s.dataType};
+ return headers[header];
+ };
+
+ var scr = /(json|script)/.test(s.dataType);
+ if (scr || s.textarea) {
+ // see if user embedded response in textarea
+ var ta = doc.getElementsByTagName('textarea')[0];
+ if (ta) {
+ xhr.responseText = ta.value;
+ }
+ else if (scr) {
+ // account for browsers injecting pre around json response
+ var pre = doc.getElementsByTagName('pre')[0];
+ var b = doc.getElementsByTagName('body')[0];
+ if (pre) {
+ xhr.responseText = pre.textContent;
+ }
+ else if (b) {
+ xhr.responseText = b.innerHTML;
+ }
+ }
+ }
+ else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
+ xhr.responseXML = toXml(xhr.responseText);
+ }
+
+ data = httpData(xhr, s.dataType, s);
+ }
+ catch(e){
+ log('error caught:',e);
+ ok = false;
+ xhr.error = e;
+ s.error && s.error.call(s.context, xhr, 'error', e);
+ g && $.event.trigger("ajaxError", [xhr, s, e]);
+ }
+
+ if (xhr.aborted) {
+ log('upload aborted');
+ ok = false;
+ }
+
+ // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+ if (ok) {
+ s.success && s.success.call(s.context, data, 'success', xhr);
+ g && $.event.trigger("ajaxSuccess", [xhr, s]);
+ }
+
+ g && $.event.trigger("ajaxComplete", [xhr, s]);
+
+ if (g && ! --$.active) {
+ $.event.trigger("ajaxStop");
+ }
+
+ s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
+
+ // clean up
+ setTimeout(function() {
+ $io.removeData('form-plugin-onload');
+ $io.remove();
+ xhr.responseXML = null;
+ }, 100);
+ }
+
+ var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
+ if (window.ActiveXObject) {
+ doc = new ActiveXObject('Microsoft.XMLDOM');
+ doc.async = 'false';
+ doc.loadXML(s);
+ }
+ else {
+ doc = (new DOMParser()).parseFromString(s, 'text/xml');
+ }
+ return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
+ };
+ var parseJSON = $.parseJSON || function(s) {
+ return window['eval']('(' + s + ')');
+ };
+
+ var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
+ var ct = xhr.getResponseHeader('content-type') || '',
+ xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if (xml && data.documentElement.nodeName === 'parsererror') {
+ $.error && $.error('parsererror');
+ }
+ if (s && s.dataFilter) {
+ data = s.dataFilter(data, type);
+ }
+ if (typeof data === 'string') {
+ if (type === 'json' || !type && ct.indexOf('json') >= 0) {
+ data = parseJSON(data);
+ } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
+ $.globalEval(data);
+ }
+ }
+ return data;
+ };
+ }
+};
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for elements (if the element
+ * is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ * used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.
+ */
+$.fn.ajaxForm = function(options) {
+ // in jQuery 1.3+ we can fix mistakes with the ready state
+ if (this.length === 0) {
+ var o = { s: this.selector, c: this.context };
+ if (!$.isReady && o.s) {
+ log('DOM not ready, queuing ajaxForm');
+ $(function() {
+ $(o.s,o.c).ajaxForm(options);
+ });
+ return this;
+ }
+ // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
+ log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
+ return this;
+ }
+
+ return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
+ if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
+ e.preventDefault();
+ $(this).ajaxSubmit(options);
+ }
+ }).bind('click.form-plugin', function(e) {
+ var target = e.target;
+ var $el = $(target);
+ if (!($el.is(":submit,input:image"))) {
+ // is this a child element of the submit el? (ex: a span within a button)
+ var t = $el.closest(':submit');
+ if (t.length == 0) {
+ return;
+ }
+ target = t[0];
+ }
+ var form = this;
+ form.clk = target;
+ if (target.type == 'image') {
+ if (e.offsetX != undefined) {
+ form.clk_x = e.offsetX;
+ form.clk_y = e.offsetY;
+ } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
+ var offset = $el.offset();
+ form.clk_x = e.pageX - offset.left;
+ form.clk_y = e.pageY - offset.top;
+ } else {
+ form.clk_x = e.pageX - target.offsetLeft;
+ form.clk_y = e.pageY - target.offsetTop;
+ }
+ }
+ // clear form vars
+ setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
+ });
+};
+
+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+$.fn.ajaxFormUnbind = function() {
+ return this.unbind('submit.form-plugin click.form-plugin');
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property. An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ */
+$.fn.formToArray = function(semantic) {
+ var a = [];
+ if (this.length === 0) {
+ return a;
+ }
+
+ var form = this[0];
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
+ if (!els) {
+ return a;
+ }
+
+ var i,j,n,v,el,max,jmax;
+ for(i=0, max=els.length; i < max; i++) {
+ el = els[i];
+ n = el.name;
+ if (!n) {
+ continue;
+ }
+
+ if (semantic && form.clk && el.type == "image") {
+ // handle image inputs on the fly when semantic == true
+ if(!el.disabled && form.clk == el) {
+ a.push({name: n, value: $(el).val()});
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ continue;
+ }
+
+ v = $.fieldValue(el, true);
+ if (v && v.constructor == Array) {
+ for(j=0, jmax=v.length; j < jmax; j++) {
+ a.push({name: n, value: v[j]});
+ }
+ }
+ else if (v !== null && typeof v != 'undefined') {
+ a.push({name: n, value: v});
+ }
+ }
+
+ if (!semantic && form.clk) {
+ // input type=='image' are not found in elements array! handle it here
+ var $input = $(form.clk), input = $input[0];
+ n = input.name;
+ if (n && !input.disabled && input.type == 'image') {
+ a.push({name: n, value: $input.val()});
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ }
+ }
+ return a;
+};
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&name2=value2
+ */
+$.fn.formSerialize = function(semantic) {
+ //hand off to jQuery.param for proper encoding
+ return $.param(this.formToArray(semantic));
+};
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&name2=value2
+ */
+$.fn.fieldSerialize = function(successful) {
+ var a = [];
+ this.each(function() {
+ var n = this.name;
+ if (!n) {
+ return;
+ }
+ var v = $.fieldValue(this, successful);
+ if (v && v.constructor == Array) {
+ for (var i=0,max=v.length; i < max; i++) {
+ a.push({name: n, value: v[i]});
+ }
+ }
+ else if (v !== null && typeof v != 'undefined') {
+ a.push({name: this.name, value: v});
+ }
+ });
+ //hand off to jQuery.param for proper encoding
+ return $.param(a);
+};
+
+/**
+ * Returns the value(s) of the element in the matched set. For example, consider the following form:
+ *
+ *
+ *
+ * var v = $(':text').fieldValue();
+ * // if no values are entered into the text inputs
+ * v == ['','']
+ * // if values entered into the text inputs are 'foo' and 'bar'
+ * v == ['foo','bar']
+ *
+ * var v = $(':checkbox').fieldValue();
+ * // if neither checkbox is checked
+ * v === undefined
+ * // if both checkboxes are checked
+ * v == ['B1', 'B2']
+ *
+ * var v = $(':radio').fieldValue();
+ * // if neither radio is checked
+ * v === undefined
+ * // if first radio is checked
+ * v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true. If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array. If no valid value can be determined the
+ * array will be empty, otherwise it will contain one or more values.
+ */
+$.fn.fieldValue = function(successful) {
+ for (var val=[], i=0, max=this.length; i < max; i++) {
+ var el = this[i];
+ var v = $.fieldValue(el, successful);
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
+ continue;
+ }
+ v.constructor == Array ? $.merge(val, v) : val.push(v);
+ }
+ return val;
+};
+
+/**
+ * Returns the value of the field element.
+ */
+$.fieldValue = function(el, successful) {
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+ if (successful === undefined) {
+ successful = true;
+ }
+
+ if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+ (t == 'checkbox' || t == 'radio') && !el.checked ||
+ (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+ tag == 'select' && el.selectedIndex == -1)) {
+ return null;
+ }
+
+ if (tag == 'select') {
+ var index = el.selectedIndex;
+ if (index < 0) {
+ return null;
+ }
+ var a = [], ops = el.options;
+ var one = (t == 'select-one');
+ var max = (one ? index+1 : ops.length);
+ for(var i=(one ? index : 0); i < max; i++) {
+ var op = ops[i];
+ if (op.selected) {
+ var v = op.value;
+ if (!v) { // extra pain for IE...
+ v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
+ }
+ if (one) {
+ return v;
+ }
+ a.push(v);
+ }
+ }
+ return a;
+ }
+ return $(el).val();
+};
+
+/**
+ * Clears the form data. Takes the following actions on the form's input fields:
+ * - input text fields will have their 'value' property set to the empty string
+ * - select elements will have their 'selectedIndex' property set to -1
+ * - checkbox and radio inputs will have their 'checked' property set to false
+ * - inputs of type submit, button, reset, and hidden will *not* be effected
+ * - button elements will *not* be effected
+ */
+$.fn.clearForm = function() {
+ return this.each(function() {
+ $('input,select,textarea', this).clearFields();
+ });
+};
+
+/**
+ * Clears the selected form elements.
+ */
+$.fn.clearFields = $.fn.clearInputs = function() {
+ return this.each(function() {
+ var t = this.type, tag = this.tagName.toLowerCase();
+ if (t == 'text' || t == 'password' || tag == 'textarea') {
+ this.value = '';
+ }
+ else if (t == 'checkbox' || t == 'radio') {
+ this.checked = false;
+ }
+ else if (tag == 'select') {
+ this.selectedIndex = -1;
+ }
+ });
+};
+
+/**
+ * Resets the form data. Causes all form elements to be reset to their original value.
+ */
+$.fn.resetForm = function() {
+ return this.each(function() {
+ // guard against an input with the name of 'reset'
+ // note that IE reports the reset function as an 'object'
+ if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
+ this.reset();
+ }
+ });
+};
+
+/**
+ * Enables or disables any matching elements.
+ */
+$.fn.enable = function(b) {
+ if (b === undefined) {
+ b = true;
+ }
+ return this.each(function() {
+ this.disabled = !b;
+ });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ */
+$.fn.selected = function(select) {
+ if (select === undefined) {
+ select = true;
+ }
+ return this.each(function() {
+ var t = this.type;
+ if (t == 'checkbox' || t == 'radio') {
+ this.checked = select;
+ }
+ else if (this.tagName.toLowerCase() == 'option') {
+ var $sel = $(this).parent('select');
+ if (select && $sel[0] && $sel[0].type == 'select-one') {
+ // deselect all other options
+ $sel.find('option').selected(false);
+ }
+ this.selected = select;
+ }
+ });
+};
+
+// helper fn for console logging
+// set $.fn.ajaxSubmit.debug to true to enable debug logging
+function log() {
+ if ($.fn.ajaxSubmit.debug) {
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
+ if (window.console && window.console.log) {
+ window.console.log(msg);
+ }
+ else if (window.opera && window.opera.postError) {
+ window.opera.postError(msg);
+ }
+ }
+};
+
+})(jQuery);
\ No newline at end of file
Index: lams_tool_laqa/web/learning/AnswersContent.jsp
===================================================================
diff -u -r4c9365155a19f048af7f0465ced0b965141292d5 -r91f0740e75daa643981b757e49d1ed2ed7f0a528
--- lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 4c9365155a19f048af7f0465ced0b965141292d5)
+++ lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 91f0740e75daa643981b757e49d1ed2ed7f0a528)
@@ -34,12 +34,38 @@
-
+
+
+
+
+
+
+