Index: lams_tool_laqa/build.xml
===================================================================
diff -u -r170db6e86b5e45e85b9c34439a57e31febd5a627 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/build.xml (.../build.xml) (revision 170db6e86b5e45e85b9c34439a57e31febd5a627)
+++ lams_tool_laqa/build.xml (.../build.xml) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -295,6 +295,7 @@
+
@@ -439,4 +440,5 @@
+
\ No newline at end of file
Index: lams_tool_laqa/db/sql/create_lams_tool_qa.sql
===================================================================
diff -u -r339224163d7ed472c4fa6c30fe92445aa0715cbe -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/db/sql/create_lams_tool_qa.sql (.../create_lams_tool_qa.sql) (revision 339224163d7ed472c4fa6c30fe92445aa0715cbe)
+++ lams_tool_laqa/db/sql/create_lams_tool_qa.sql (.../create_lams_tool_qa.sql) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -84,16 +84,10 @@
+
-- data for content table
-INSERT INTO tl_laqa11_content (qa_content_id,
- creation_date
- )
-VALUES (${default_content_id},
- NOW());
+--INSERT INTO tl_laqa11_content (qa_content_id, creation_date) VALUES (${default_content_id}, NOW());
-
-- data for content questions table
-INSERT INTO tl_laqa11_que_content (question,
- display_order,
- qa_content_id) VALUES ('What is the capital of Russia?',1,${default_content_id});
+-- INSERT INTO tl_laqa11_que_content (question, display_order, qa_content_id) VALUES ('What is the capital of Russia?',1,${default_content_id});
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -14,7 +14,7 @@
*
*/
public interface QaAppConstants {
- /**
+ /*
* Currently we are hardcoding the default content id.
* This will be replaced when the deploy logic automatically assigns a default content id in the deploy script.
*/
@@ -23,12 +23,12 @@
public static final long DEFAULT_CONTENT_ID =0;
public static final long DEFAULT_QUE_CONTENT_ID =1;
- /**
+ /*
* temporarily refers to an existing content id for an incoming tool session id, won't need it in deployment environment
*/
public static final long THE_MOCKED_CONTENT_ID =1803739427456570536L;
public static final String TOOL_SERVICE ="tool_service";
- /**
+ /*
* indicates which mode the tool runs under between Authoring, Learning, Monitoring
*/
public static final String TARGET_MODE ="targetMode";
@@ -41,20 +41,20 @@
public static final String LEARNING_STARTER ="learningStarter";
public static final String MONITORING_STARTER ="monitoringStarter";
- /**
+ /*
* Mock constants below are temporary until the tool gets a User object from the container.
*/
public static final Integer MOCK_USER_ID = new Integer(111);
public static final String MOCK_USER_NAME ="Ozgur";
public static final String MOCK_USER_LASTNAME ="Demirtas";
public static final String MOCK_LOGIN_NAME ="ozgur";
- /**
+ /*
* refers to number of questions presented initially, we have a single record for default content
*/
public static final Long INITIAL_QUESTION_COUNT =new Long(1);
- /**
+ /*
* Struts level constants
*/
public static final String LOAD ="load";
@@ -65,14 +65,14 @@
public static final String DISABLE_TOOL ="disabled";
public static final String IS_DEFINE_LATER ="isDefineLater";
- /**
+ /*
* authoring mode controllers
*/
public static final String IS_ADD_QUESTION ="isAddQuestion";
public static final String IS_REMOVE_QUESTION ="isRemoveQuestion";
public static final String IS_REMOVE_CONTENT ="isRemoveContent";
- /**
+ /*
* tab controllers, constants for authoring page html tabs, used within jsp
*/
public static final String CHOICE ="choice";
@@ -81,7 +81,7 @@
public static final String CHOICE_TYPE_INSTRUCTIONS ="choiceTypeInstructions";
- /**
+ /*
* authoring mode constants
*/
public static final String MAP_QUESTION_CONTENT ="mapQuestionContent";
@@ -121,12 +121,12 @@
public static final String POPULATED_UPLOADED_FILESDATA ="populateUploadedFilesData";
- /**
+ /*
* the author's current content id
*/
public static final String TOOL_CONTENT_ID ="toolContentId";
- /**
+ /*
* the learner or monitoring environment provides toolSessionId
*/
public static final String TOOL_SESSION_ID ="toolSessionId";
@@ -157,7 +157,7 @@
public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup";
public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions";
- /**
+ /*
* export portfolio constants
*/
public static final String MODE ="mode";
@@ -168,7 +168,7 @@
public static final String PORTFOLIO_REQUEST ="portfolioRequest";
public static final int MAX_GROUPS_COUNT =250;
- /**
+ /*
* user actions
*/
public static final String ADD_NEW_QUESTION ="addNewQuestion";
@@ -203,7 +203,7 @@
public static final String ACTIVITY_TITLE ="activityTitle";
public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions";
- /**
+ /*
* Monitoring Mode constants
*/
public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor";
@@ -240,7 +240,7 @@
public static final String MONITORED_ONLINE_INSTRUCTIONS ="monitoredOnlineInstructions";
public static final String MONITORING_INSTRUCTIONS_UPDATE_MESSAGE ="monitoringInstructionsUpdateMessage";
- /**
+ /*
* Monitor and Learning common constants - used in jsp reporting
*/
public static final String FULLNAME ="fullName";
@@ -254,7 +254,7 @@
public static final String TIMEZONE ="timeZone";
public static final String TIMEZONE_ID ="timeZoneId";
- /**
+ /*
* following tell whether author prefers to have the questions listed all in one page or listed sequentially. The default is all in one page.
*/
public static final String QUESTION_LISTING_MODE ="questionListingMode";
@@ -265,7 +265,7 @@
public static final String FEEDBACK_TYPE_COMBINED ="You are being presented a total of : ";
public static final String QUESTIONS =" questions.";
- /**
+ /*
* constants redundant for the moment
*/
public static final String DISPLAY_QUESTIONS ="display";
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java (.../QaQueContent.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueContent.java (.../QaQueContent.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -58,7 +58,6 @@
/** nullable persistent field */
private int displayOrder;
-
/** nullable persistent field */
private org.lamsfoundation.lams.tool.qa.QaContent qaContent;
@@ -68,10 +67,10 @@
/** persistent field */
private Set qaQueUsers;
- /** Struts form convenient field */
+ /** Struts form convenience field */
private String[] userResponses = {};
- /** Struts form convenient field */
+ /** Struts form convenience field */
private String otherResponse;
/** nullable persistent field */
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java (.../QaSession.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaSession.java (.../QaSession.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -70,6 +70,7 @@
/** persistent field */
private Set qaQueUsers;
+ /** persistent field */
private Long qaContentId;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -55,7 +55,6 @@
* Common utility functions live here.
*/
public abstract class QaUtils implements QaAppConstants {
-
static Logger logger = Logger.getLogger(QaUtils.class.getName());
public static IQaService getToolService(HttpServletRequest request)
@@ -64,14 +63,6 @@
return qaService;
}
-
- /**
- * generateId()
- * return long
- * IMPORTANT: The way we obtain either content id or tool session id must be modified
- * so that we only use lams common to get these ids. This functionality is not
- * available yet in the lams common as of 21/04/2005.
- */
public static long generateId()
{
Random generator = new Random();
@@ -94,16 +85,14 @@
}
-
/**
* cleanupSession(TreeMap mapQuestionContent, HttpServletRequest request)
* return void
* cleans up the session of the content details
*/
-
public static void cleanupSession(HttpServletRequest request)
{
- //remove session attributes in Authoring mode
+ /* remove session attributes in Authoring mode */
request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT);
request.getSession().removeAttribute(MAP_QUESTION_CONTENT);
request.getSession().removeAttribute(CHOICE);
@@ -117,8 +106,7 @@
request.getSession().removeAttribute(TITLE);
request.getSession().removeAttribute(CONTENT_LOCKED);
-
- //remove session attributes in Learner mode
+ /* remove session attributes in Learner mode */
request.getSession().removeAttribute(MAP_ANSWERS);
request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER);
request.getSession().removeAttribute(CURRENT_QUESTION_INDEX);
@@ -135,11 +123,11 @@
request.getSession().removeAttribute(END_LEARNING_MESSAGE);
request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE);
- //remove session attributes in Monitoring mode
+ /* remove session attributes in Monitoring mode */
request.getSession().removeAttribute(MAP_TOOL_SESSIONS);
request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS);
- //remove session attributes used commonly
+ /* remove session attributes used commonly */
request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
request.getSession().removeAttribute(REPORT_TITLE_MONITOR);
request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED);
@@ -148,12 +136,18 @@
request.getSession().removeAttribute(ATTR_USERDATA);
request.getSession().removeAttribute(TOOL_SERVICE);
request.getSession().removeAttribute(TARGET_MODE);
-
}
+ /**
+ * setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm)
+ *
+ * @param request
+ * @param defaultQaContent
+ * @param qaAuthoringForm
+ */
public static void setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm)
{
- /**should never be null anyway as default content MUST exist in the db*/
+ /*should never be null anyway as default content MUST exist in the db*/
if (defaultQaContent != null)
{
qaAuthoringForm.setTitle(defaultQaContent.getTitle());
@@ -187,17 +181,17 @@
{
User userCompleteData = (User) request.getSession().getAttribute(ATTR_USERDATA);
logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData: " + userCompleteData);
- /**
+ /*
* if no session cache available, retrieve it from data source
*/
if (userCompleteData == null)
{
- /**
+ /*
* WebUtil.getUsername(request,DEVELOPMENT_FLAG) returns the current learner's username based on
* user principals defined in the container. If no username is defined in the container, we get a RunTimeException.
*/
- /**
+ /*
* pass testing flag as false to obtain user principal
*/
try
@@ -213,7 +207,7 @@
}
logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData from service: " + userCompleteData);
- //this can be redundant as we keep the User data in TOOL_USER
+ /* this can be redundant as we keep the User data in TOOL_USER */
request.getSession().setAttribute(ATTR_USERDATA, userCompleteData);
}
return userCompleteData;
@@ -222,7 +216,7 @@
public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException
{
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
logger.debug(logger + " " + "QaUtils" + " Current user is: " + user + " with id: " + user.getUserID());
return user.getUserID().intValue();
@@ -281,7 +275,6 @@
}
-
public static User createSimpleUser(Integer userId)
{
User user=new User();
@@ -315,9 +308,6 @@
*/
public static boolean existsContent(long toolContentId, HttpServletRequest request)
{
- /**
- * retrive the service
- */
IQaService qaService =QaUtils.getToolService(request);
QaContent qaContent=qaService.loadQa(toolContentId);
@@ -336,9 +326,6 @@
*/
public static boolean existsSession(long toolSessionId, HttpServletRequest request)
{
- /**
- * get the service
- */
logger.debug("existsSession");
IQaService qaService =QaUtils.getToolService(request);
QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId);
@@ -366,7 +353,12 @@
logger.debug("current timezone id: " + timeZone.getID());
request.getSession().setAttribute(TIMEZONE_ID, timeZone.getID());
}
-
+
+ /**
+ * stores the rich text values on the forms into the session scope
+ * persistRichText(HttpServletRequest request)
+ * @param request
+ */
public static void persistRichText(HttpServletRequest request)
{
String richTextOfflineInstructions=request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS);
@@ -400,6 +392,7 @@
}
}
+
public static void configureContentRepository(HttpServletRequest request)
{
logger.debug("attempt configureContentRepository");
@@ -410,6 +403,7 @@
logger.debug("configureContentRepository ran successfully");
}
+
public static void addFileToContentRepository(HttpServletRequest request, QaAuthoringForm qaAuthoringForm, boolean isOfflineFile)
{
logger.debug("attempt addFileToContentRepository");
@@ -507,7 +501,7 @@
*/
- /**holds final online files list */
+ /* holds final online files list */
List listUploadedOnlineFiles= (List) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILES);
logger.debug("listUploadedOnlineFiles: " + listUploadedOnlineFiles);
@@ -554,7 +548,7 @@
if (isOfflineFile)
{
- /** read uploaded file informtion - offline file*/
+ /* read uploaded file informtion - offline file*/
logger.debug("retrieve theOfflineFile.");
FormFile theOfflineFile = qaAuthoringForm.getTheOfflineFile();
logger.debug("retrieved theOfflineFile: " + theOfflineFile);
@@ -694,7 +688,7 @@
QaContent defaultQaContent=qaService.loadQa(new Long(toolContentId).longValue());
logger.debug("defaultQaContent: " + defaultQaContent);
- /** read the uploaded offline uuid + file name pair */
+ /* read the uploaded offline uuid + file name pair */
List listOnlineFilesName=new LinkedList();
listOnlineFilesName=qaService.retrieveQaUploadedOnlineFilesName(defaultQaContent);
logger.debug("listOnlineFilesName: " + listOnlineFilesName);
@@ -727,42 +721,38 @@
IQaService qaService =QaUtils.getToolService(request);
logger.debug("qaService: " + qaService);
- /** just for jsp purposes **
- /** read the uploaded offline uuid + file name pair */
+ /* just for jsp purposes **
+ /* read the uploaded offline uuid + file name pair */
List listOfflineFilesUuid=new LinkedList();
listOfflineFilesUuid=qaService.retrieveQaUploadedOfflineFilesUuid(defaultQaContent);
logger.debug("initial listOfflineFilesUuid: " + listOfflineFilesUuid);
request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID);
request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID, listOfflineFilesUuid);
- /** read the uploaded online uuid + file name pair */
+ /* read the uploaded online uuid + file name pair */
List listOnlineFilesUuid=new LinkedList();
listOnlineFilesUuid=qaService.retrieveQaUploadedOnlineFilesUuid(defaultQaContent);
logger.debug("initial listOnlineFilesUuid: " + listOnlineFilesUuid);
request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_UUID);
request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES_UUID, listOnlineFilesUuid);
-
- /** read the uploaded offline uuid + file name pair */
+ /* read the uploaded offline uuid + file name pair */
List listOfflineFilesName=new LinkedList();
listOfflineFilesName=qaService.retrieveQaUploadedOfflineFilesName(defaultQaContent);
logger.debug("initial listOfflineFilesName: " + listOfflineFilesName);
request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME);
request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME, listOfflineFilesName);
-
- /** read the uploaded online uuid + file name pair */
+ /* read the uploaded online uuid + file name pair */
List listOnlineFilesName=new LinkedList();
listOnlineFilesName=qaService.retrieveQaUploadedOnlineFilesName(defaultQaContent);
logger.debug("initial listOnlineFilesName: " + listOnlineFilesName);
request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_NAME);
request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES_NAME, listOnlineFilesName);
-
request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILENAMES);
request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES);
request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES, listOfflineFilesName);
request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES, listOnlineFilesName);
}
-
}
Fisheye: Tag e693b778e6201af40e4ea93f2a0d06b5ca5cf462 refers to a dead (removed) revision in file `lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/SubmissionDetails.java'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java
===================================================================
diff -u -r664a5459e87fdfde268c9c54e458618c0965f816 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision 664a5459e87fdfde268c9c54e458618c0965f816)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaContentDAO.java (.../QaContentDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -23,6 +23,7 @@
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
import org.apache.log4j.Logger;
+import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.lamsfoundation.lams.tool.qa.QaContent;
@@ -128,17 +129,20 @@
Object obj = getSession().createQuery(query)
.setLong(0,qaContentId.longValue())
.uniqueResult();
+ this.getSession().setFlushMode(FlushMode.AUTO);
getHibernateTemplate().delete(obj);
}
}
public void deleteQa(QaContent qaContent)
{
- this.getHibernateTemplate().delete(qaContent);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(qaContent);
}
public void removeQaById(Long qaId)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
removeQa(qaId);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java
===================================================================
diff -u -r6e5832d17263bc6c6f7683733e91e22f97eab569 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision 6e5832d17263bc6c6f7683733e91e22f97eab569)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueContentDAO.java (.../QaQueContentDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -24,6 +24,7 @@
import java.util.List;
+import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.Session;
@@ -80,12 +81,14 @@
public void createQueContent(QaQueContent queContent)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(queContent);
}
public void removeQueContent(long qaQueContentId)
{
QaQueContent qaQueContent= (QaQueContent) this.getHibernateTemplate().load(QaQueContent.class, new Long(qaQueContentId));
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(qaQueContent);
}
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java
===================================================================
diff -u -r6e5832d17263bc6c6f7683733e91e22f97eab569 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision 6e5832d17263bc6c6f7683733e91e22f97eab569)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -7,6 +7,7 @@
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
import org.apache.log4j.Logger;
+import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.qa.QaQueUsr;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.dao.IQaQueUsrDAO;
@@ -48,11 +49,13 @@
public void createUsr(QaQueUsr usr)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(usr);
}
public void deleteQaQueUsr(QaQueUsr qaQueUsr)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(qaQueUsr);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java
===================================================================
diff -u -r6e5832d17263bc6c6f7683733e91e22f97eab569 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision 6e5832d17263bc6c6f7683733e91e22f97eab569)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaSessionDAO.java (.../QaSessionDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -22,6 +22,7 @@
import java.util.List;
+import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.qa.QaContent;
import org.lamsfoundation.lams.tool.qa.QaSession;
import org.lamsfoundation.lams.tool.qa.dao.IQaSessionDAO;
@@ -83,6 +84,7 @@
*/
public void CreateQaSession(QaSession session)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(session);
}
@@ -91,6 +93,7 @@
*/
public void UpdateQaSession(QaSession session)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(session);
}
@@ -99,6 +102,7 @@
*/
public void deleteQaSession(QaSession qaSession)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(qaSession);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java
===================================================================
diff -u -r6e5832d17263bc6c6f7683733e91e22f97eab569 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java (.../QaUploadedFileDAO.java) (revision 6e5832d17263bc6c6f7683733e91e22f97eab569)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUploadedFileDAO.java (.../QaUploadedFileDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -22,12 +22,15 @@
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;
@@ -50,6 +53,8 @@
private static final String GET_OFFLINE_FILES_UUID = "select qaUploadedFile.uuid from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=0";
private static final String GET_OFFLINE_FILES_NAME ="select qaUploadedFile.fileName from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=0 order by qaUploadedFile.uuid";
+ private static final String DELETE_FILES_META_DATA = "from qaUploadedFile in class QaUploadedFile";
+
public QaUploadedFile getUploadedFileById(long submissionId)
{
return (QaUploadedFile) this.getHibernateTemplate()
@@ -69,30 +74,51 @@
public void updateUploadFile(QaUploadedFile qaUploadedFile)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(qaUploadedFile);
}
public void saveUploadFile(QaUploadedFile qaUploadedFile)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(qaUploadedFile);
}
public void createUploadFile(QaUploadedFile qaUploadedFile)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(qaUploadedFile);
}
public void UpdateUploadFile(QaUploadedFile qaUploadedFile)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(qaUploadedFile);
}
public void cleanUploadedFilesMetaData()
{
+ /*
String query = "from uploadedFile in class org.lamsfoundation.lams.tool.qa.QaUploadedFile";
- this.getHibernateTemplate().delete(query);
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ this.getHibernateTemplate().delete(query);
+ */
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(DELETE_FILES_META_DATA)
+ .list();
+
+ if(list != null && list.size() > 0){
+ Iterator listIterator=list.iterator();
+ while (listIterator.hasNext())
+ {
+ QaUploadedFile mcFile=(QaUploadedFile)listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcFile);
+ templ.flush();
+ }
+ }
}
public void removeUploadFile(Long submissionId)
@@ -105,6 +131,7 @@
.setLong(0,submissionId.longValue())
.uniqueResult();
if ( obj != null ) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(obj);
}
}
@@ -179,6 +206,7 @@
public void deleteUploadFile(QaUploadedFile qaUploadedFile)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(qaUploadedFile);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java
===================================================================
diff -u -r6e5832d17263bc6c6f7683733e91e22f97eab569 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision 6e5832d17263bc6c6f7683733e91e22f97eab569)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaUsrRespDAO.java (.../QaUsrRespDAO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -20,8 +20,7 @@
*/
package org.lamsfoundation.lams.tool.qa.dao.hibernate;
-import org.hibernate.Hibernate;
-
+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;
@@ -44,6 +43,7 @@
public void createUserResponse(QaUsrResp qaUsrResp)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(qaUsrResp);
}
@@ -59,6 +59,7 @@
*/
public void saveUserResponse(QaUsrResp resp)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().save(resp);
}
@@ -67,11 +68,13 @@
*/
public void updateUserResponse(QaUsrResp resp)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(resp);
}
public void removeUserResponse(QaUsrResp resp)
{
+ this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(resp);
}
@@ -85,6 +88,7 @@
.setLong(0,qaQueId.longValue())
.uniqueResult();
if ( obj != null ) {
+ this.getSession().setFlushMode(FlushMode.AUTO);
getHibernateTemplate().delete(obj);
}
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java
===================================================================
diff -u -r11cf843a79fc61f3b4cef8bdf52c788f604b285c -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 11cf843a79fc61f3b4cef8bdf52c788f604b285c)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -110,8 +110,7 @@
private IUserManagementService userManagementService;
private ILamsToolService toolService;
-
-
+
public void configureContentRepository() throws QaApplicationException {
logger.debug("retrieved repService: " + repositoryService);
cred = new SimpleCredentials(repositoryUser, repositoryId);
@@ -629,7 +628,7 @@
try
{
logger.debug("getCurrentUserData: " + username);
- /**
+ /*
* this will return null if the username not found
*/
User user=userManagementService.getUserByLogin(username);
@@ -721,9 +720,11 @@
/**
- * checks the paramter content in the user responses table
+ * checks the paramter content in the user responses table
+ * boolean studentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException
+ *
* @param qa
- * @return
+ * @return boolean
* @throws QaApplicationException
*/
public boolean studentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException
@@ -738,7 +739,7 @@
while (responsesIterator.hasNext())
{
logger.debug("there is at least one response");
- /**
+ /*
* proved the fact that there is at least one response for this content.
*/
return true;
@@ -749,6 +750,14 @@
}
+ /**
+ * counts the number of sessions marked INCOMPLETE for a content
+ * int countIncompleteSession(QaContent qa) throws QaApplicationException
+ *
+ * @param qa
+ * @return int
+ * @throws QaApplicationException
+ */
public int countIncompleteSession(QaContent qa) throws QaApplicationException
{
logger.debug("start of countIncompleteSession: " + qa);
@@ -759,10 +768,11 @@
}
/**
- * checks the parameter content in the tool sessions table
- *
+ * 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
+ *
+ * boolean studentActivityOccurred(QaContent qa) throws QaApplicationException
* @param qa
* @return boolean
* @throws QaApplicationException
@@ -787,12 +797,10 @@
* 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
{
logger.debug("start of copyToolContent with ids: " + fromContentId + " and " + toContentId);
@@ -872,11 +880,11 @@
/**
* TO BE DEFINED-FUTURE API
+ * setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException
*
* update the tool session status to COMPLETE for this tool session
* IMPLEMENT THIS!!!! Is this from ToolContentManager???
*
-
* @param Long toolSessionId
*/
public void setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException
@@ -894,11 +902,11 @@
/**
* TO BE DEFINED
+ * setAsForceComplete(Long userId) throws QaApplicationException
+ *
* TESTED
* update the tool session status to COMPLETE for this user
* IMPLEMENT THIS!!!! Is this from ToolContentManager???
- *
-
* @param userId
*/
public void setAsForceComplete(Long userId) throws QaApplicationException
@@ -926,7 +934,7 @@
logger.debug("qaSession uses qaContent : " + qaContent);
logger.debug("qaSession uses qaContentId : " + qaContent.getQaContentId());
- /**
+ /*
* if all the sessions of this content is COMPLETED, unlock the content
*
*/
@@ -978,6 +986,7 @@
}
/**
+ * setAsDefineLater(Long toolContentId) throws DataMissingException, ToolException
* TESTED
* set the defineLater to true on this content
*
@@ -1004,6 +1013,7 @@
}
/**
+ * setAsRunOffline(Long toolContentId) throws DataMissingException, ToolException
* TESTED
* set the runOffline to true on this content
*
@@ -1030,9 +1040,10 @@
}
-
/**
- * !!! UNUSED !!!
+ *
+ * removeToolContent(Long toolContentId)
+ * ! UNUSED !
* TESTED
* gets automatically called only in monitoring mode when the author chooses to delete a lesson.
*
@@ -1080,11 +1091,11 @@
}
- /*
+ /**
* DOUBLE CHECK!
+ * 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
- * (non-Javadoc)
- * @see org.lamsfoundation.lams.tool.ToolContentManager#removeToolContent(java.lang.Long, boolean)
+ *
*/
public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException
{
@@ -1168,6 +1179,7 @@
}
/**
+ * createToolSession(Long toolSessionId, Long toolContentId) throws ToolException
* TESTED
* ToolSessionManager CONTRACT : creates a tool session with the incoming toolSessionId in the tool session table
*
@@ -1229,7 +1241,7 @@
logger.debug("final - retrieved qaContent: " + qaContent);
- /**
+ /*
* create a new a new tool session if it does not already exist in the tool session table
*/
if (!existsSession(toolSessionId.longValue()))
@@ -1299,12 +1311,13 @@
/**FIX THIS ONE!!!!
+ * String leaveToolSession(Long toolSessionId,User learner) throws DataMissingException, ToolException
+ *
* TO BE TESTED
* ToolSessionManager CONTRACT
* gets called only in the Learner mode.
- *
* Call controller service to complete the qa session
- * @see org.lamsfoundation.lams.tool.ToolSessionManager#leaveToolSession(java.lang.Long)
+ *
*/
public String leaveToolSession(Long toolSessionId,User learner) throws DataMissingException, ToolException
{
@@ -1485,6 +1498,7 @@
}
}
+
public InputStream downloadFile(Long uuid, Long versionID)throws QaApplicationException{
ITicket ticket = getRepositoryLoginTicket();
try{
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r9d6dababf4dd2550d08b30ec6e4235779fe466c6 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 9d6dababf4dd2550d08b30ec6e4235779fe466c6)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -171,7 +171,7 @@
String choiceAdvanced=qaAuthoringForm.getChoiceAdvanced();
String choiceInstructions=qaAuthoringForm.getChoiceInstructions();
- /** make the Basic tab the default one */
+ /* make the Basic tab the default one */
request.getSession().setAttribute(CHOICE,CHOICE_TYPE_BASIC);
if (choiceBasic != null)
@@ -191,13 +191,13 @@
}
logger.debug("CHOICE is:" + request.getSession().getAttribute(CHOICE));
- /** reset tab controllers */
+ /* reset tab controllers */
qaAuthoringForm.choiceBasic=null;
qaAuthoringForm.choiceAdvanced=null;
qaAuthoringForm.choiceInstructions=null;
- /**
+ /*
* if the presentation is for monitoring EditActivity screen, keep preserving request scope START_MONITORING_SUMMARY_REQUEST
*/
Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY);
@@ -246,7 +246,7 @@
/**
- * createContent(TreeMap mapQuestionContent)
+ * QaContent createContent(Map mapQuestionContent, HttpServletRequest request, QaAuthoringForm qaAuthoringForm)
* return QaContent
* At this stage, the Map is available from the presentaion layer and can be passed to services layer for persistance.
* We are making the content and question contents persistent.
@@ -256,15 +256,16 @@
{
IQaService qaService =QaUtils.getToolService(request);
- /** the tool content id is passed from the container to the tool and placed into session in the QaStarterAction */
+ /* the tool content id is passed from the container to the tool and placed into session in the QaStarterAction */
String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID);
- if ((toolContentId != null) && (!toolContentId.equals("")))
- {
- logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId));
- /**delete the existing content in the database before applying new content*/
- qaService.deleteQaById(new Long(toolContentId));
- logger.debug("post-deletion existing content");
- }
+ /*
+ if ((toolContentId != null) && (!toolContentId.equals("")))
+ {
+ logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId));
+ qaService.deleteQaById(new Long(toolContentId));
+ logger.debug("post-deletion existing content");
+ }
+ */
logger.debug("using TOOL_CONTENT_ID: " + toolContentId);
request.getSession().setAttribute(TOOL_CONTENT_ID,toolContentId);
@@ -330,8 +331,7 @@
if (creationDate == null)
creationDate=new Date(System.currentTimeMillis()).toString();
-
- /** read rich text values */
+ /* read rich text values */
String richTextOfflineInstructions="";
richTextOfflineInstructions = (String)request.getSession().getAttribute(RICHTEXT_OFFLINEINSTRUCTIONS);
logger.debug("createContent: richTextOfflineInstructions from session: " + richTextOfflineInstructions);
@@ -353,17 +353,17 @@
if (richTextInstructions == null) richTextInstructions="";
- /**obtain user object from the session*/
+ /* obtain user object from the session*/
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO*/
UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
logger.debug("retrieving toolUser: " + toolUser);
logger.debug("retrieving toolUser userId: " + toolUser.getUserID());
String fullName= toolUser.getFirstName() + " " + toolUser.getLastName();
logger.debug("retrieving toolUser fullname: " + fullName);
long userId=toolUser.getUserID().longValue();
- /** create a new qa content and leave the default content intact*/
+ /* create a new qa content and leave the default content intact*/
QaContent qa = new QaContent();
qa.setQaContentId(new Long(toolContentId));
qa.setTitle(richTextTitle);
@@ -384,7 +384,7 @@
qa.setQaUploadedFiles(new TreeSet());
logger.debug("qa content :" + qa);
- /**create the content in the db*/
+ /* create the content in the db*/
qaService.createQa(qa);
logger.debug("qa created with content id: " + toolContentId);
@@ -468,7 +468,7 @@
Map.Entry pairs = (Map.Entry)itMap.next();
logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue());
- /**make sure question entered is NOT blank*/
+ /*make sure question entered is NOT blank*/
if (pairs.getValue().toString().length() != 0)
{
QaQueContent queContent= new QaQueContent(pairs.getValue().toString(),
@@ -510,7 +510,7 @@
if ((toolContentId != null) && (!toolContentId.equals("")))
{
logger.debug("simulate container behaviour by calling: removeToolContent with: " + new Long(toolContentId));
- /**
+ /*
* we are calling removeToolContent to clear content tables although this method normally
* gets called only in the monitoring mode automatically by the core.
*
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java
===================================================================
diff -u -r9d6dababf4dd2550d08b30ec6e4235779fe466c6 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision 9d6dababf4dd2550d08b30ec6e4235779fe466c6)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java (.../LearningUtil.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -40,14 +40,15 @@
public class LearningUtil implements QaAppConstants{
static Logger logger = Logger.getLogger(LearningUtil.class.getName());
- /**
+ /**
* NEVER USED: redundant method.
+ * deleteSessionUsersAndResponses(HttpServletRequest request)
* @param request
*/
protected void deleteSessionUsersAndResponses(HttpServletRequest request)
{
IQaService qaService =QaUtils.getToolService(request);
- /**
+ /*
* retrive contentId from the http session
*/
logger.debug("attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID));
@@ -92,7 +93,7 @@
protected void deleteExistingUsersAndResponses(HttpServletRequest request)
{
IQaService qaService =QaUtils.getToolService(request);
- /**
+ /*
* retrive contentId from the http session
*/
logger.debug("attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID));
@@ -101,9 +102,6 @@
logger.debug("retrieving qaContent: " + qaContent);
- /**
- * get iterator of questions collection
- */
Iterator contentIterator=qaContent.getQaQueContents().iterator();
while (contentIterator.hasNext())
{
@@ -113,7 +111,7 @@
{
Set qaQueUsers=qaQueContent.getQaQueUsers();
logger.debug("qaQueUsers size: " + qaQueUsers.size());
- /**
+ /*
* iterate users and delete them
*/
Iterator usersIterator=qaQueUsers.iterator();
@@ -159,12 +157,12 @@
logger.debug("createUsers-retrieving qaService: " + qaService);
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
logger.debug("retrieving toolUser: " + toolUser);
logger.debug("retrieving toolUser userId: " + toolUser.getUserID());
logger.debug("retrieving toolUser username: " + toolUser.getLogin());
- /**
+ /*
* !!double check this!!
*/
String userName=toolUser.getLogin();
@@ -173,18 +171,18 @@
Long userId=new Long(toolUser.getUserID().longValue());
- /**
+ /*
* retrive contentId from the http session
*/
logger.debug("createUsers-attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID));
Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
- /**
+ /*
* obtain QaContent to be used in creating QaQueUsr
*/
QaContent qaContent=qaService.retrieveQa(toolContentId.longValue());
logger.debug("createUsers-retrieving qaContent: " + qaContent);
- /**
+ /*
* get QaSession to be used in creating QaQueUsr
*/
Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
@@ -214,16 +212,16 @@
QaQueContent qaQueContent=(QaQueContent)contentIterator.next();
if (qaQueContent != null)
{
- /**
+ /*
* get the question
*/
String question=qaQueContent.getQuestion();
- /**
+ /*
* get the question's display order
*/
String displayOrder=new Long(qaQueContent.getDisplayOrder()).toString();
- /**
+ /*
* get the answer from the map of that displayOrder
*/
String answer=(String)mapAnswers.get(displayOrder);
@@ -266,21 +264,20 @@
{
IQaService qaService =QaUtils.getToolService(request);
- /**
+ /*
* find out the current tool session
*/
Long toolSessionId=(Long) request.getSession().getAttribute(TOOL_SESSION_ID);
logger.debug("processUserResponses using toolSessionId: " + toolSessionId);
- /**
+ /*
* holds all the tool sessions passed in from the url
* used in monitoring mode
*/
Map mapToolSessions=(Map)request.getSession().getAttribute(MAP_TOOL_SESSIONS);
logger.debug("retrieving MAP_TOOL_SESSIONS from the session: " + mapToolSessions);
-
- /**
+ /*
* keys of the Map refers to questions and values refers to user info and their entries
* used in learning mode
*/
@@ -296,13 +293,13 @@
logger.debug("content iteration count: " + qaContent.getQaQueContents().size());
int questionIndex=0;
- /**
+ /*
* used to iterate responses to questions within the tool sessions in the jsp level in the monitoring mode
*/
Map mapQuestions= new TreeMap(new QaStringComparator());
logger.debug("mapQuestions created with QaStringComparator");
- /**
+ /*
* used to iterate questions within the tool sessions in the jsp level in the monitoring mode
*/
Map mapMonitoringQuestions= new TreeMap(new QaStringComparator());
@@ -314,13 +311,13 @@
logger.debug("retrieve qaQueContent: " + qaQueContent);
if (qaQueContent != null)
{
- /**
+ /*
* obtain All responses from ALL users to this question
*/
Set qaUsrResps=qaQueContent.getQaUsrResps();
logger.debug("the set of user responses qaUsrResps: " + qaUsrResps);
- /**
+ /*
* deal with all responses
*/
questionIndex=questionIndex+1;
@@ -333,12 +330,12 @@
if (targetMode.equalsIgnoreCase(TARGET_MODE_MONITORING))
{
Map mapUserResponses=processUserResponses(request, qaUsrResps, questionIndex, new TreeMap());
- /**
+ /*
* Map mapQuestions for holding the question index /responses pair
*/
mapQuestions.put(new Integer(questionIndex).toString(),mapUserResponses);
logger.debug("getting mapQuestions: " + mapQuestions);
- /**
+ /*
* Map mapQuestions for holding the questions themselves
*/
mapMonitoringQuestions.put(new Integer(questionIndex).toString(),qaQueContent.getQuestion());
@@ -383,13 +380,13 @@
{
logger.debug("will be processing user responses: ");
- /**
+ /*
* find out the current tool session
*/
Long toolSessionId=(Long) request.getSession().getAttribute(TOOL_SESSION_ID);
logger.debug("processUserResponses using toolSessionId: " + toolSessionId);
- /**
+ /*
* find out the tool's mode. We produce different reports for learning and monitoring
*/
String targetMode=(String)request.getSession().getAttribute(TARGET_MODE);
@@ -403,23 +400,23 @@
logger.debug("the set of user responses for a particular question is empty.");
Iterator itResps=qaUsrResps.iterator();
- /**
+ /*
* obtain each response and the user that replied with that response
*/
int responseIndex=0;
while (itResps.hasNext())
{
QaUsrResp qaUsrResp=(QaUsrResp)itResps.next();
logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex);
- /**
+ /*
* Don't include the blank answers in the report. Make sure it is the requirement.
*/
if ((qaUsrResp != null) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals("")))
{
logger.debug("iterated qaUsrResp:" + qaUsrResp);
logger.debug("isResponseHidden: " + qaUsrResp.isHidden());
QaQueUsr qaQueUsr=qaUsrResp.getQaQueUser();
- //find out what you need to display: fullname or login (userName)?
+ /* find out what you need to display: fullname or login (userName)? */
logger.debug("iterated qaQueUsr fullName:" + qaQueUsr.getFullname());
logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getUsername());
logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession());
@@ -450,18 +447,18 @@
else if (targetMode.equalsIgnoreCase(TARGET_MODE_LEARNING))
{
logger.debug("processUserResponses for TARGET_MODE: " + targetMode);
- /**
+ /*
* find out whos is the current user. Important to know for reporting responses in learning mode
*/
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER);
logger.debug("retrieving toolUser: " + toolUser + " userName: " + toolUser.getLogin());
- /**
+ /*
* !!double check if String userName=toolUser.getLogin();
*/
- /**
+ /*
* see whether you have to report only the current learner's name and make invisible all the other learner's names in the report.
* A boolean true isUsernameVisible indicates that all user names to be displayed.
* Only applies to learning mode.
@@ -475,15 +472,15 @@
logger.debug("the set of user responses for a particular question is empty.");
Iterator itResps=qaUsrResps.iterator();
- /**
+ /*
* obtain each response and the user that replied with that response
*/
int responseIndex=0;
while (itResps.hasNext())
{
QaUsrResp qaUsrResp=(QaUsrResp)itResps.next();
logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex);
- /**
+ /*
* Don't include the blank answers in the report. Make sure it is the requirement.
*/
if ((qaUsrResp != null) && (!qaUsrResp.isHidden()) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals("")))
@@ -496,18 +493,18 @@
logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession());
logger.debug("using responseIndex: " + responseIndex);
- /**
+ /*
* find out if the current tool user's login(userName) is the same as the iterated user's userName.
* If there is a match we need to display that person first in the report
* !!do this when User objkect issue is resolved!!!
*/
- /**
+ /*
* these are all the other users. See if we have the permission to display their names.
* if we are permitted, get ready to display all available information
*/
- /**
+ /*
* get user's tool session
*/
QaSession qaSession=qaQueUsr.getQaSession();
@@ -530,14 +527,14 @@
request.getSession().setAttribute(FULLNAME + questionIndex +""+ responseIndex, qaQueUsr.getFullname());
}
- else /** we won't display the usernames of these users*/
+ else /* we won't display the usernames of these users*/
{
logger.debug("IS_USERNAME_VISIBLE:" + isUsernameVisible.booleanValue());
mapUserResponses.put(new Integer(responseIndex).toString(), " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer());
logger.debug("Building request level response data with: " +
"aTime" + questionIndex +""+ responseIndex);
}
- /**
+ /*
* place these whether username visible or not
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -1,9 +1,3 @@
-/**
- *
- * Keeps all operations needed for Learning mode.
- * @author ozgurd
- *
- */
package org.lamsfoundation.lams.tool.qa.web;
import java.util.Iterator;
@@ -32,10 +26,10 @@
/**
* determine whether all the tool sessions for a particular content has been COMPLETED
+ * boolean isSessionsSync(HttpServletRequest request, long toolContentId)
* @param toolContentId
- * @return
+ * @return boolean
*/
-
public boolean isSessionsSync(HttpServletRequest request, long toolContentId)
{
logger.debug("start of isSessionsSync with toolContentId: " + toolContentId);
@@ -44,7 +38,7 @@
QaContent qaContent =qaService.loadQa(toolContentId);
logger.debug("retrieving qaContent: " + qaContent);
- /**
+ /*
* iterate all the tool sessions, if even one session is INCOMPLETE, the function returns false
*/
if (qaContent != null)
@@ -62,6 +56,11 @@
return true;
}
+
+ /**
+ * cleanupMonitoringSession(HttpServletRequest request)
+ * @param request
+ */
public void cleanupMonitoringSession(HttpServletRequest request)
{
request.getSession().removeAttribute(MAP_TOOL_SESSIONS);
@@ -73,7 +72,7 @@
request.getSession().removeAttribute(DATAMAP_EDITABLE_RESPONSE_ID);
request.getSession().removeAttribute(DATAMAP_HIDDEN_RESPONSE_ID);
- /** remove session attributes used commonly */
+ /* remove session attributes used commonly */
request.getSession().removeAttribute(IS_USERNAME_VISIBLE);
request.getSession().removeAttribute(REPORT_TITLE_MONITOR);
request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED);
@@ -84,7 +83,13 @@
request.getSession().removeAttribute(TARGET_MODE);
}
-
+ /**
+ * startLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request) throws ToolException
+ *
+ * @param qaMonitoringForm
+ * @param request
+ * @throws ToolException
+ */
public void startLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request) throws ToolException
{
IQaService qaService=QaUtils.getToolService(request);
@@ -93,7 +98,7 @@
String strToToolContentId="";
qaMonitoringForm.resetUserAction();
- /**
+ /*
* In deployment, we won't be passing FROM_TOOL_CONTENT_ID, TO_TOOL_CONTENT_ID and TOOL_SESSION_ID from url
* the Monitoring Service bean calls:
* copyToolContent(Long fromContentId, Long toContentId)
@@ -124,11 +129,11 @@
throw e;
}
- /** calls to these two methods will be made from Monitoring Service bean optionally depending on
+ /* calls to these two methods will be made from Monitoring Service bean optionally depending on
* the the tool is setup for DefineLater and (or) RunOffline
*/
- /**
+ /*
* TESTED to work
* qaService.setAsDefineLater(new Long(strToToolContentId));
qaService.setAsRunOffline(new Long(strToToolContentId));
@@ -137,7 +142,11 @@
qaMonitoringForm.resetUserAction();
}
-
+ /**
+ * deleteLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request)
+ * @param qaMonitoringForm
+ * @param request
+ */
public void deleteLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request)
{
IQaService qaService=QaUtils.getToolService(request);
@@ -147,7 +156,7 @@
qaMonitoringForm.resetUserAction();
- /**
+ /*
* TESTED to work
*/
strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID);
@@ -161,11 +170,16 @@
qaMonitoringForm.resetUserAction();
}
-
+
+ /**
+ * forceComplete(QaMonitoringForm qaMonitoringForm, HttpServletRequest request)
+ * @param qaMonitoringForm
+ * @param request
+ */
public void forceComplete(QaMonitoringForm qaMonitoringForm, HttpServletRequest request)
{
IQaService qaService=QaUtils.getToolService(request);
- /**
+ /*
* Parameter: userId
*/
qaMonitoringForm.resetUserAction();
@@ -176,8 +190,12 @@
logger.debug("end of setAsForceComplete with userId: " + userId);
}
-
- public boolean isDefaultMonitoringScreen(QaMonitoringForm qaMonitoringForm)
+ /**
+ * boolean isDefaultMonitoringScreen(QaMonitoringForm qaMonitoringForm)
+ * @param qaMonitoringForm
+ * @return boolean
+ */
+ public boolean isDefaultMonitoringScreen(QaMonitoringForm qaMonitoringForm)
{
if ((qaMonitoringForm.getSummary() == null) &&
(qaMonitoringForm.getInstructions() == null) &&
@@ -207,7 +225,7 @@
String choiceTypeMonitoringEditActivity=qaMonitoringForm.getEditActivity();
String choiceTypeMonitoringStats=qaMonitoringForm.getStats();
- /**make the Summary tab the default one */
+ /* make the Summary tab the default one */
request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_SUMMARY);
if (choiceTypeMonitoringSummary != null)
@@ -232,13 +250,18 @@
}
logger.debug("CHOICE_MONITORING is:" + request.getSession().getAttribute(CHOICE_MONITORING));
- /** reset tab controllers */
+ /* reset tab controllers */
qaMonitoringForm.setSummary(null);
qaMonitoringForm.setInstructions(null);
qaMonitoringForm.setEditActivity(null);
qaMonitoringForm.setStats(null);
}
+ /**
+ * boolean isNonDefaultScreensVisited(HttpServletRequest request)
+ * @param request
+ * @return boolean
+ */
public boolean isNonDefaultScreensVisited(HttpServletRequest request)
{
Boolean monitoringInstructionsVisited = (Boolean) request.getSession().getAttribute(MONITORING_INSTRUCTIONS_VISITED);
@@ -259,7 +282,13 @@
return false;
}
-
+
+ /**
+ * updateResponse(HttpServletRequest request, String responseId, String updatedResponse)
+ * @param request
+ * @param responseId
+ * @param updatedResponse
+ */
public void updateResponse(HttpServletRequest request, String responseId, String updatedResponse)
{
IQaService qaService=QaUtils.getToolService(request);
@@ -272,6 +301,11 @@
logger.debug("updated user response in the db: " + qaUsrResp);
}
+ /**
+ * hideResponse(HttpServletRequest request, String responseId)
+ * @param request
+ * @param responseId
+ */
public void hideResponse(HttpServletRequest request, String responseId)
{
IQaService qaService=QaUtils.getToolService(request);
@@ -284,7 +318,11 @@
logger.debug("updated user response in the db: " + qaUsrResp);
}
-
+ /**
+ * unHideResponse(HttpServletRequest request, String responseId)
+ * @param request
+ * @param responseId
+ */
public void unHideResponse(HttpServletRequest request, String responseId)
{
IQaService qaService=QaUtils.getToolService(request);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QAction.java (.../QAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -121,8 +121,6 @@
/**
*
- * @author ozgurd
- *
* TOOL PARAMETERS: ?? (toolAccessMode) ??
* Authoring environment: toolContentId
* Learning environment: toolSessionId + toolContentId
@@ -219,24 +217,21 @@
AuthoringUtil authoringUtil= new AuthoringUtil();
- /**
- * find out which tab is the active one.
- */
- authoringUtil.findSelectedTab(mapping,
+ authoringUtil.findSelectedTab(mapping,
form,
request,
response);
QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form;
-
IQaService qaService =QaUtils.getToolService(request);
- /**
+ /*
* the status of define later is determined from the property inspector and
* by now, we know whether it is on or off
*
* enable-disable tool html elements based on "define later" status
*/
+
/*
* double check QaUtils.getDefineLaterStatus()
*/
@@ -255,54 +250,27 @@
request.getSession().setAttribute(DISABLE_TOOL,"disabled");
}
- /**retrieve the default question content map */
+ /*retrieve the default question content map */
Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT);
logger.debug("MAP_QUESTION_CONTENT:" + request.getSession().getAttribute(MAP_QUESTION_CONTENT));
String userAction="";
- if (qaAuthoringForm.getAddContent() != null)
- {
- userAction=ADD_NEW_QUESTION;
- }
- else if (qaAuthoringForm.getRemoveContent() != null)
- {
- userAction=REMOVE_QUESTION;
- }
- else if (qaAuthoringForm.getRemoveAllContent() != null)
- {
- userAction=REMOVE_ALL_CONTENT;
- }
- else if (qaAuthoringForm.getSubmitTabDone() != null)
- {
- userAction=SUBMIT_TAB_DONE;
- }
- else if (qaAuthoringForm.getSubmitAllContent() != null)
- {
- userAction=SUBMIT_ALL_CONTENT;
- }
- else if (qaAuthoringForm.getSubmitOfflineFile() != null)
- {
- userAction=SUBMIT_OFFLINE_FILE;
- }
- else if (qaAuthoringForm.getSubmitOnlineFile() != null)
- {
- userAction=SUBMIT_ONLINE_FILE;
- }
- logger.debug("user action is: " + userAction);
-
+ userAction=getUserAction(qaAuthoringForm);
+ logger.debug("returned userAction:" + userAction);
+
QaUtils.persistRichText(request);
- /** add a new question to Map */
+ /* add a new question to Map */
if (userAction.equalsIgnoreCase(ADD_NEW_QUESTION))
{
request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, request);
- }/** delete a question*/
+ }/* delete a question*/
else if (userAction.equalsIgnoreCase(REMOVE_QUESTION))
{
request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
authoringUtil.reconstructQuestionContentMapForRemove(mapQuestionContent, request, qaAuthoringForm);
- } /**remove selected content*/
+ } /* remove selected content*/
else if (userAction.equalsIgnoreCase(REMOVE_ALL_CONTENT))
{
authoringUtil.removeAllDBContent(request);
@@ -335,71 +303,21 @@
logger.debug("user is done with this tab.");
qaAuthoringForm.resetUserAction();
return (mapping.findForward(LOAD_QUESTIONS));
- }/**submit questions contained in the Map*/
+ }/*submit questions contained in the Map*/
else if (userAction.equalsIgnoreCase(SUBMIT_ALL_CONTENT))
{
ActionMessages errors= new ActionMessages();
+ /* full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity */
+ errors=validateSubmit(request, errors, qaAuthoringForm);
- /**
- * full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity
- */
-
- String richTextTitle=(String) request.getSession().getAttribute(RICHTEXT_TITLE);
- logger.debug("richTextTitle: " + richTextTitle);
- String richTextInstructions=(String) request.getSession().getAttribute(RICHTEXT_INSTRUCTIONS);
- logger.debug("richTextInstructions: " + richTextInstructions);
-
- if ((richTextTitle == null) || (richTextTitle.length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK))
+ if (errors.size() > 0)
{
- errors.add(Globals.ERROR_KEY,new ActionMessage("error.title"));
- logger.debug("add title to ActionMessages");
- }
-
- if ((richTextInstructions == null) || (richTextInstructions.length() == 0) || richTextInstructions.equalsIgnoreCase(RICHTEXT_BLANK))
- {
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.instructions"));
- logger.debug("add instructions to ActionMessages: ");
- }
-
- /**
- * enforce that the first (default) question entry is not empty
- */
- String defaultQuestionEntry =request.getParameter("questionContent0");
- if ((defaultQuestionEntry == null) || (defaultQuestionEntry.length() == 0))
- {
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.defaultquestion.empty"));
- logger.debug("add error.defaultquestion.empty to ActionMessages: ");
- }
-
- Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY);
- if ((renderMonitoringEditActivity != null) && (!renderMonitoringEditActivity.booleanValue()))
- {
-
- if ((qaAuthoringForm.getReportTitle() == null) || (qaAuthoringForm.getReportTitle().length() == 0))
- {
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.reportTitle"));
- logger.debug("add reportTitle to ActionMessages: ");
- }
-
- if ((qaAuthoringForm.getMonitoringReportTitle() == null) || (qaAuthoringForm.getMonitoringReportTitle().length() == 0))
- {
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.monitorReportTitle"));
- logger.debug("add monitorReportTitle to ActionMessages: ");
- }
- }
- /**
- * end of error validation
- */
-
- saveErrors(request,errors);
- if (errors.size() > 0)
- {
logger.debug("returning back to from to fix errors:");
request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true));
return (mapping.findForward(LOAD_QUESTIONS));
}
- /**
+ /*
* look after defineLater flag
*/
Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID);
@@ -411,13 +329,13 @@
}
authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request);
- /**delete existing content from the database*/
+ /*delete existing content from the database*/
authoringUtil.removeAllDBContent(request);
- /**create-recreate the content in the db*/
+ /*create-recreate the content in the db*/
QaContent qaContent=authoringUtil.createContent(mapQuestionContent, request, qaAuthoringForm);
authoringUtil.createQuestionContent(mapQuestionContent, request, qaContent);
- /**give the user a feedback*/
+ /*give the user a feedback*/
errors.clear();
errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful"));
logger.debug("submit successful.");
@@ -428,18 +346,121 @@
logger.debug("Warning!: Uncatered-for user action: " + userAction);
}
- /**reset all user actions*/
qaAuthoringForm.resetUserAction();
/*
ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, WebUtil.PARAM_MODE,MODE_OPTIONAL);
logger.debug("retrieving mode: " + mode);
*/
-
return (mapping.findForward(LOAD_QUESTIONS));
}
+
+ /**
+ * perform error validation on form submit
+ *
+ * ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, QaAuthoringForm qaAuthoringForm)
+ * @param request
+ * @param errors
+ * @param qaAuthoringForm
+ * @return ActionMessages
+ */
+ protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, QaAuthoringForm qaAuthoringForm)
+ {
+ String richTextTitle=(String) request.getSession().getAttribute(RICHTEXT_TITLE);
+ logger.debug("richTextTitle: " + richTextTitle);
+ String richTextInstructions=(String) request.getSession().getAttribute(RICHTEXT_INSTRUCTIONS);
+ logger.debug("richTextInstructions: " + richTextInstructions);
+
+ if ((richTextTitle == null) || (richTextTitle.length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK))
+ {
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.title"));
+ logger.debug("add title to ActionMessages");
+ }
+
+ if ((richTextInstructions == null) || (richTextInstructions.length() == 0) || richTextInstructions.equalsIgnoreCase(RICHTEXT_BLANK))
+ {
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.instructions"));
+ logger.debug("add instructions to ActionMessages: ");
+ }
+
+ /*
+ * enforce that the first (default) question entry is not empty
+ */
+ String defaultQuestionEntry =request.getParameter("questionContent0");
+ if ((defaultQuestionEntry == null) || (defaultQuestionEntry.length() == 0))
+ {
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.defaultquestion.empty"));
+ logger.debug("add error.defaultquestion.empty to ActionMessages: ");
+ }
+
+ Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY);
+ if ((renderMonitoringEditActivity != null) && (!renderMonitoringEditActivity.booleanValue()))
+ {
+
+ if ((qaAuthoringForm.getReportTitle() == null) || (qaAuthoringForm.getReportTitle().length() == 0))
+ {
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.reportTitle"));
+ logger.debug("add reportTitle to ActionMessages: ");
+ }
+
+ if ((qaAuthoringForm.getMonitoringReportTitle() == null) || (qaAuthoringForm.getMonitoringReportTitle().length() == 0))
+ {
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.monitorReportTitle"));
+ logger.debug("add monitorReportTitle to ActionMessages: ");
+ }
+ }
+
+ /* end of error validation */
+
+ saveErrors(request,errors);
+ return errors;
+ }
+
+ /**
+ * determine the chosen user action
+ *
+ * String getUserAction(QaAuthoringForm qaAuthoringForm)
+ * @param qaAuthoringForm
+ * @return
+ */
+ protected String getUserAction(QaAuthoringForm qaAuthoringForm)
+ {
+ String userAction="";
+ if (qaAuthoringForm.getAddContent() != null)
+ {
+ userAction=ADD_NEW_QUESTION;
+ }
+ else if (qaAuthoringForm.getRemoveContent() != null)
+ {
+ userAction=REMOVE_QUESTION;
+ }
+ else if (qaAuthoringForm.getRemoveAllContent() != null)
+ {
+ userAction=REMOVE_ALL_CONTENT;
+ }
+ else if (qaAuthoringForm.getSubmitTabDone() != null)
+ {
+ userAction=SUBMIT_TAB_DONE;
+ }
+ else if (qaAuthoringForm.getSubmitAllContent() != null)
+ {
+ userAction=SUBMIT_ALL_CONTENT;
+ }
+ else if (qaAuthoringForm.getSubmitOfflineFile() != null)
+ {
+ userAction=SUBMIT_OFFLINE_FILE;
+ }
+ else if (qaAuthoringForm.getSubmitOnlineFile() != null)
+ {
+ userAction=SUBMIT_ONLINE_FILE;
+ }
+ logger.debug("user action is: " + userAction);
+ return userAction;
+ }
+
+
/**
* This method manages the presentation Map for the learner mode.
* The dispatch method to decide which view should be shown to the user.
@@ -467,7 +488,7 @@
HttpServletResponse response) throws IOException,
ServletException
{
- /**
+ /*
* if the content is not ready yet, don't even proceed.
* check the define later status
*/
@@ -482,17 +503,16 @@
LearningUtil learningUtil= new LearningUtil();
QaLearningForm qaLearningForm = (QaLearningForm) form;
- /**retrieve the default question content map*/
+ /*retrieve the default question content map*/
Map mapQuestions=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER);
logger.debug("MAP_QUESTION_CONTENT_LEARNER:" + request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER));
- /**retrieve the answers Map*/
- Map mapAnswers=(Map)request.getSession().getAttribute(MAP_ANSWERS);
+ Map mapAnswers=(Map)request.getSession().getAttribute(MAP_ANSWERS);
logger.debug("MAP_ANSWERS:" + mapAnswers);
- /**obtain author's question listing preference*/
+ /*obtain author's question listing preference*/
String questionListingMode=(String) request.getSession().getAttribute(QUESTION_LISTING_MODE);
- /**maintain Map either based on sequential listing or based on combined listing*/
+ /* maintain Map either based on sequential listing or based on combined listing*/
if (questionListingMode.equalsIgnoreCase(QUESTION_LISTING_MODE_SEQUENTIAL))
{
logger.debug("QUESTION_LISTING_MODE_SEQUENTIAL");
@@ -520,7 +540,7 @@
logger.debug("currentQuestionIndex will be: " + currentQuestionIndex);
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, new Long(currentQuestionIndex));
learningUtil.feedBackAnswersProgress(request,currentQuestionIndex);
- qaLearningForm.resetUserActions(); /**resets all except submitAnswersContent */
+ qaLearningForm.resetUserActions(); /*resets all except submitAnswersContent */
}
else
{
@@ -533,51 +553,52 @@
}
}
- /**
+ /*
* At this point the Map holding learner responses is ready. So place that into the session.
*/
request.getSession().setAttribute(MAP_ANSWERS, mapAnswers);
- /**
+ /*
* Learner submits the responses to the questions.
*/
if (qaLearningForm.getSubmitAnswersContent() != null)
{
logger.debug(logger + " " + this.getClass().getName() + "submit the responses: " + mapAnswers);
- /**recreate the users and responses*/
+ /*recreate the users and responses*/
learningUtil.createUsersAndResponses(mapAnswers, request);
qaLearningForm.resetUserActions();
qaLearningForm.setSubmitAnswersContent(null);
- /**start generating a report for the Learner*/
+ /*start generating a report for the Learner*/
learningUtil.buidLearnerReport(request,1);
learningUtil.lockContent(request);
logger.debug("content has been locked");
return (mapping.findForward(LEARNER_REPORT));
}
- /**
+ /*
* Simulate learner leaving the current tool session. This will normally gets called by the container by
* leaveToolSession(toolSessionId, user)
*/
else if (qaLearningForm.getEndLearning() != null)
{
- /**
+ /*
* The learner is done with the tool session. The tool needs to clean-up.
*/
Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID);
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /*get back login user DTO*/
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
logger.debug("simulating container behaviour by calling " +
"leaveToolSession() with toolSessionId: " + toolSessionId + " and user: " + user);
IQaService qaService =QaUtils.getToolService(request);
QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue());
qaSession.setSession_end_date(new Date(System.currentTimeMillis()));
- /**
+ /*
* ?? mark the tool session as COMPLETE ??
*/
+
/*
* change the logic about completion status
*/
@@ -595,24 +616,28 @@
*/
}
- /**
- * Also cleanup session attributes
- */
+ /* Also cleanup session attributes */
QaUtils.cleanupSession(request);
- /** reset all user actions */
qaLearningForm.resetUserActions();
return (mapping.findForward(LOAD));
}
/**
* used to load Monitoring tabs back once the controller moves to Edit Activity.
+ *
+ * ActionForward loadMonitoring(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+
* @param mapping
* @param form
* @param request
* @param response
- * @return
+ * @return ActionForward
* @throws IOException
* @throws ServletException
*/
@@ -676,9 +701,12 @@
}
return null;
}
+
/**
* persists error messages to request scope
+ *
+ * persistError(HttpServletRequest request, String message)
* @param request
* @param message
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java
===================================================================
diff -u -ra4b9dfe6935887930d266eedb191089ea52914cc -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision a4b9dfe6935887930d266eedb191089ea52914cc)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -7,7 +7,7 @@
*/
package org.lamsfoundation.lams.tool.qa.web;
-/**
+/*
* ActionForm for the Authoring environment
*/
import org.apache.struts.action.ActionForm;
@@ -21,7 +21,7 @@
* Window - Preferences - Java - Code Style - Code Templates
*/
public class QaAuthoringForm extends ActionForm implements QaAppConstants {
- /** form controllers */
+ /* form controllers */
protected String addContent;
protected String removeContent;
protected String removeAllContent;
@@ -30,33 +30,33 @@
protected String submitOfflineFile;
protected String submitOnlineFile;
- /** tab controller, these may go away once the Flash wraps the jsp */
+ /* tab controller, these may go away once the Flash wraps the jsp */
protected String choice;
protected String choiceBasic;
protected String choiceAdvanced;
protected String choiceInstructions;
- /** basic content */
+ /* basic content */
protected String title;
protected String instructions;
protected String questionIndex;
protected String isRemoveContent;
protected String toolContentId;
- /** instructions content */
+ /* instructions content */
protected String onlineInstructions;
protected String offlineInstructions;
protected FormFile theOfflineFile;
protected FormFile theOnlineFile;
- /** advanced content */
+ /* advanced content */
protected String synchInMonitor;
protected String reportTitle;
protected String monitoringReportTitle;
protected String endLearningMessage;
protected String usernameVisible;
protected String questionsSequenced;
- /** proxy controllers for Monitoring tabs */
+ /* proxy controllers for Monitoring tabs */
protected String summaryMonitoring;
protected String instructionsMonitoring;
protected String editActivityMonitoring;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java (.../QaEmptyForm.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaEmptyForm.java (.../QaEmptyForm.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -7,9 +7,6 @@
*/
package org.lamsfoundation.lams.tool.qa.web;
-/**
- * ActionForm for the Learning environment
- */
import org.apache.struts.action.ActionForm;
/**
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java
===================================================================
diff -u -rcae190bef6a3e4f857bdfaff17eb3a0ae680cb72 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java (.../QaExportPortfolioForm.java) (revision cae190bef6a3e4f857bdfaff17eb3a0ae680cb72)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioForm.java (.../QaExportPortfolioForm.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -7,9 +7,6 @@
*/
package org.lamsfoundation.lams.tool.qa.web;
-/**
- * ActionForm for the Monitoring environment
- */
import org.apache.struts.action.ActionForm;
import org.lamsfoundation.lams.tool.qa.QaAppConstants;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (.../QaExportPortfolioStarterAction.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaExportPortfolioStarterAction.java (.../QaExportPortfolioStarterAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -51,7 +51,6 @@
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -62,32 +61,29 @@
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException, QaApplicationException, ToolException
{
- /**
- * retrive the service
- */
IQaService qaService=null;
qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
logger.debug("retrieved qaService : " + qaService);
request.getSession().setAttribute(TOOL_SERVICE, qaService);
-
- /**
+ /*
* persist time zone information to session scope.
*/
QaUtils.persistTimeZone(request);
- /**
- * mark the http session as an authoring activity
+ /*
+ * mark the http session as an export portfolio activity
*/
- //request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_EXPORT_PORTFOLIO);
+
+ //request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_EXPORT_PORTFOLIO);
- /**
+ /*
* obtain and setup the current user's data
*/
- //get session from shared session.
+ /* get session from shared session.*/
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
if ((user == null) || (user.getUserID() == null))
{
@@ -153,7 +149,6 @@
}
logger.debug("final toolSessionId before exists test :" + toolSessionId);
-
QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue());
if (qaSession == null)
{
@@ -204,10 +199,9 @@
}
}
- /**
+ /*
at this point we have session attributes TOOL_CONTENT_ID, TOOL_SESSION_ID AND MODE ready to use
*/
-
mode=(String)request.getSession().getAttribute(MODE);
logger.debug("mode is: " + mode);
@@ -226,7 +220,7 @@
logger.debug("using qaContent id : " + qaContent.getQaContentId());
request.getSession().setAttribute(TOOL_CONTENT_ID, qaContent.getQaContentId());
- /** is other learner's full name visible to this learner */
+ /* other learner's full name visible to this learner? */
logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible());
request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(qaContent.isUsernameVisible()));
@@ -251,7 +245,7 @@
logger.debug("generate portfolio for mode: " + mode);
request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_LEARNING);
- /** a single toolSessionId */
+ /* a single toolSessionId */
request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId);
logger.debug("build a learner report:");
learningUtil.buidLearnerReport(request, 1);
@@ -265,7 +259,7 @@
logger.debug("generate portfolio for mode: " + mode);
request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_MONITORING);
- /** we already know that this content exists in the db */
+ /* we already know that this content exists in the db */
QaContent qa=qaService.loadQa(toolContentId.longValue());
logger.debug("qa: " + qa);
listToolSessions= qaService.getToolSessionsForContent(qa);
@@ -291,7 +285,7 @@
}
}
- /** the flag to differentiate between request for monitoring versus request for portfolio */
+ /* the flag to differentiate between request for monitoring versus request for portfolio */
request.setAttribute(PORTFOLIO_REQUEST, new Boolean(true));
logger.debug("generate portfolio jsp for mode: " + mode);
logger.debug("mapToolSessions: " + request.getSession().getAttribute(MAP_TOOL_SESSIONS));
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -22,7 +22,7 @@
public class QaLearningForm extends ActionForm implements QaAppConstants {
protected String answer;
protected String currentQuestionIndex;
- /** form controllers */
+ /* form controllers */
protected String submitAnswersContent;
protected String getNextQuestion;
protected String getPreviousQuestion;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -33,7 +33,6 @@
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -104,11 +103,11 @@
public class QaLearningStarterAction extends Action implements QaAppConstants {
static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName());
- /**
+ /*
* holds the question contents for a given tool session and relevant content
*/
protected Map mapQuestions= new TreeMap(new QaComparator());
- /**
+ /*
* holds the answers
*/
protected Map mapAnswers= new TreeMap(new QaComparator());
@@ -118,47 +117,44 @@
QaLearningForm qaQaLearningForm = (QaLearningForm) form;
- /**
+ /*
* reset the question index to 1.
*/
request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1");
logger.debug("CURRENT_QUESTION_INDEX: " + request.getSession().getAttribute(CURRENT_QUESTION_INDEX));
- /**
+ /*
* reset the current answer
*/
request.getSession().setAttribute(CURRENT_ANSWER, "");
- /**
+ /*
* initialize available question display modes in the session
*/
request.getSession().setAttribute(QUESTION_LISTING_MODE_SEQUENTIAL,QUESTION_LISTING_MODE_SEQUENTIAL);
request.getSession().setAttribute(QUESTION_LISTING_MODE_COMBINED, QUESTION_LISTING_MODE_COMBINED);
- /**
- * retrive the service
- */
IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext());
logger.debug("retrieving qaService: " + qaService);
request.getSession().setAttribute(TOOL_SERVICE, qaService);
- /**
+ /*
* mark the http session as a learning activity
*/
request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_LEARNING);
- /**
+ /*
* persist time zone information to session scope.
*/
QaUtils.persistTimeZone(request);
- /**
+ /*
* obtain and setup the current user's data
*/
String userId = "";
- //get session from shared session.
+ /* get session from shared session.*/
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO*/
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
if ((user == null) || (user.getUserID() == null))
{
@@ -170,7 +166,7 @@
userId = user.getUserID().toString();
- /**
+ /*
* process incoming tool session id and later derive toolContentId from it.
*/
String strToolSessionId=request.getParameter(TOOL_SESSION_ID);
@@ -200,7 +196,7 @@
}
}
- /**
+ /*
* By now, the passed tool session id MUST exist in the db through the calling of:
* public void createToolSession(Long toolSessionId, Long toolContentId) by the container.
*
@@ -228,20 +224,20 @@
}
- /**
+ /*
* by now, we made sure that the passed tool session id exists in the db as a new record
* Make sure we can retrieve it and relavent content
*/
QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId);
logger.debug("retrieving qaSession: " + qaSession);
- /**
+ /*
* find out what content this tool session is referring to
* get the content for this tool session (many to one mapping)
*/
- /**
+ /*
* Each passed tool session id points to a particular content. Many to one mapping.
*/
QaContent qaContent=qaSession.getQaContent();
@@ -250,7 +246,7 @@
logger.debug("using TOOL_CONTENT_ID: " + qaContent.getQaContentId());
- /**
+ /*
* The content we retrieved above must have been created before in Authoring time.
* And the passed tool session id already refers to it.
*/
@@ -267,22 +263,22 @@
request.getSession().setAttribute(END_LEARNING_MESSAGE,qaContent.getEndLearningMessage());
logger.debug("END_LEARNING_MESSAGE: " + qaContent.getEndLearningMessage());
- /**
+ /*
* Is the tool activity been checked as Run Offline in the property inspector?
*/
logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + qaContent.isRunOffline());
request.getSession().setAttribute(IS_TOOL_ACTIVITY_OFFLINE, new Boolean(qaContent.isRunOffline()).toString());
logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible());
request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(qaContent.isUsernameVisible()));
- /**
+ /*
* Is the tool activity been checked as Define Later in the property inspector?
*/
logger.debug("IS_DEFINE_LATER: " + qaContent.isDefineLater());
request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater()));
- /**
- * convince jsp: Learning mode requires this setting for jsp to generate the user's report
+ /*
+ * Learning mode requires this setting for jsp to generate the user's report
*/
request.getSession().setAttribute(CHECK_ALL_SESSIONS_COMPLETED, new Boolean(false));
@@ -300,7 +296,7 @@
}
logger.debug("QUESTION_LISTING_MODE: " + request.getSession().getAttribute(QUESTION_LISTING_MODE));
- /**
+ /*
* fetch question content from content
*/
Iterator contentIterator=qaContent.getQaQueContents().iterator();
@@ -312,7 +308,7 @@
int displayOrder=qaQueContent.getDisplayOrder();
if (displayOrder != 0)
{
- /**
+ /*
* add the question to the questions Map in the displayOrder
*/
mapQuestions.put(new Integer(displayOrder).toString(),qaQueContent.getQuestion());
@@ -329,7 +325,7 @@
request.getSession().setAttribute(USER_FEEDBACK, userFeedback);
- /**
+ /*
* Verify that userId does not already exist in the db.
* If it does exist, that means, that user already responded to the content and
* his answers must be displayed read-only
@@ -345,7 +341,7 @@
logger.debug("buidLearnerReport called successfully, forwarding to: " + LEARNER_REPORT);
return (mapping.findForward(LEARNER_REPORT));
}
- /**
+ /*
* present user with the questions.
*/
logger.debug("forwarding to: " + LOAD);
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java
===================================================================
diff -u -r4c1831729bf38bebdd629cd0b4f427e61930ae01 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 4c1831729bf38bebdd629cd0b4f427e61930ae01)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -19,10 +19,9 @@
*http://www.gnu.org/licenses/gpl.txt
*/
-/**
- *
+ /**
* @author Ozgur Demirtas
-*/
+ */
package org.lamsfoundation.lams.tool.qa.web;
@@ -69,7 +68,7 @@
monitoringUtil.findSelectedMonitoringTab(form, request);
logger.debug("done with findSelectedMonitoringTab");
- /**
+ /*
* load the values for online and offline instructions
*/
handleInstructionsScreen(mapping, form, request);
@@ -84,7 +83,7 @@
logger.debug("session updated with online/offline instructions");
}
- /**
+ /*
* determine what screen(tab) to generate
*/
String choiceMonitoring=(String)request.getSession().getAttribute(CHOICE_MONITORING);
@@ -116,7 +115,24 @@
return null;
}
-
+
+ /**
+ *
+ * produces the summary screen
+ * ActionForward generateSummaryScreen(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward
+ * @throws IOException
+ * @throws ServletException
+ */
public ActionForward generateSummaryScreen(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -180,15 +196,15 @@
String isToolSessionChanged=request.getParameter(IS_TOOL_SESSION_CHANGED);
logger.debug("IS_TOOL_SESSION_CHANGED - initial: " + isToolSessionChanged);
- /**
+ /*
* sessionList holds all the toolSessionIds passed to summary page to be presented in a drop-down box.
*/
Map sessionList = new TreeMap();
int SELECTION_CASE=0;
logger.debug("isNonDefaultScreensVisited: " + monitoringUtil.isNonDefaultScreensVisited(request));
- /**
+ /*
* Following conditions test which entry has been selected in the monitoring mode-summary screen drop box.
* is Default page
*/
@@ -200,7 +216,7 @@
{
logger.debug("First case based on null. Gets rendered only once in http session life time");
logger.debug("summary to use MAX_TOOL_SESSION_COUNT");
- /**
+ /*
* initialize sessionList with "All", which is the default option.
*/
sessionList.put("All", "All");
@@ -219,14 +235,14 @@
{
String selectedToolSessionId=(String)request.getParameter("toolSessionId1");
logger.debug("selectedToolSessionId" + selectedToolSessionId);
- /**
+ /*
* is "All" selected
*/
if (selectedToolSessionId.equalsIgnoreCase("All"))
{
logger.debug("Second case");
logger.debug("summary to use MAX_TOOL_SESSION_COUNT");
- /**
+ /*
* initialize sessionList with "All", which is the default option.
*/
sessionList.put("All", "All");
@@ -236,7 +252,7 @@
}
else
{
- /**
+ /*
* is a single session id selected
*/
logger.debug("Third case");
@@ -249,7 +265,7 @@
}
else if (isToolSessionChanged.equals("") && (selectionCase.equals("3")))
{
- /**
+ /*
* is a single session id selected
*/
logger.debug("case with single session and edit or update selected");
@@ -281,7 +297,7 @@
}
qaMonitoringForm.resetUserAction();
- /**
+ /*
* holds all the toolSessionIds passed in the form toolSessionId1, toolSessionId2 etc.
*/
Map mapToolSessions= new TreeMap(new QaStringComparator());
@@ -292,7 +308,7 @@
request.getSession().setAttribute(MAP_USER_RESPONSES,mapUserResponses);
logger.debug("MAP_USER_RESPONSES placed into session");
logger.debug("request for contributeLesson");
- /**
+ /*
* monitoring reads all the toolSessionsIds appended one after other until it finds a null one. The cap was limited to 500.
* This is the case all the tool sessions are using the same content.
*
@@ -319,7 +335,7 @@
logger.debug("retrieving ORIGINAL_TOOL_SESSIONS");
Map originalSessionList=(Map)request.getSession().getAttribute(ORIGINAL_TOOL_SESSIONS);
logger.debug("retrieved ORIGINAL_TOOL_SESSIONS : " + originalSessionList);
- /**
+ /*
* monitoredToolSessionsCounter holds the total number of valid toolSessionIds passed to the monitoring url
*/
logger.debug("READABLE_TOOL_SESSION_COUNT: " + READABLE_TOOL_SESSION_COUNT);
@@ -341,7 +357,7 @@
logger.debug("original strToolSessionId: " + strToolSessionId);
String strRetrievableToolSessionId="";
- /**
+ /*
* catering for un-formatted monitoring url
* Watch for case where the "All" is selected in the drop-down.
*/
@@ -392,32 +408,32 @@
if (READABLE_TOOL_SESSION_COUNT.equals(MAX_TOOL_SESSION_COUNT))
{
logger.debug("default screen - READABLE_TOOL_SESSION_COUNT equals MAX_TOOL_SESSION_COUNT");
- /**
+ /*
* add the current toolSessionId to the arraylist for the drop-down box
*/
sessionList.put("Group" + monitoredToolSessionsCounter, strToolSessionId);
logger.debug("sessionList Map new entry, strToolSessionId added to the list: " + toolSessionIdCounter + "->" + strToolSessionId );
}
- /**
+ /*
* get to content from the tool session
*/
QaContent qaContent=qaSession.getQaContent();
logger.debug("using qaContent: " + qaContent);
logger.debug("Monitor - contribute will be using TOOL_CONTENT_ID: " + qaContent.getQaContentId());
- /**
+ /*
* editActivity-defineLater screen depends on MONITORED_CONTENT_ID
*/
request.getSession().setAttribute(MONITORED_CONTENT_ID,qaContent.getQaContentId());
- /**
+ /*
* place it into TOOL_CONTENT_ID session attribute since learningUtil.buidLearnerReport(request) depends on it
* to generate a report
*/
request.getSession().setAttribute(TOOL_CONTENT_ID,qaContent.getQaContentId());
- /**
+ /*
* this is to convince jsp although usernameVisible applies only to learning mode
*/
request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(true));
@@ -426,13 +442,13 @@
request.getSession().setAttribute(REPORT_TITLE_MONITOR,qaContent.getMonitoringReportTitle());
- /**
+ /*
* check if the author requires that the all tool sessions must be COMPLETED before the report in Monitoring
*/
boolean isAllSessionsCompleted=monitoringUtil.isSessionsSync(request,qaContent.getQaContentId().longValue());
logger.debug("Monitor - contribute will be using isAllSessionsCompleted: " + isAllSessionsCompleted);
logger.debug("Monitor - contribute will be using isSynchInMonitor: " + qaContent.isSynchInMonitor());
- /**
+ /*
* if the author requires syncronization but not all the sessions are COMPLETED give an error
*/
if (qaContent.isSynchInMonitor() && (!isAllSessionsCompleted))
@@ -453,7 +469,7 @@
logger.debug("CHECK_ALL_SESSIONS_COMPLETED" + request.getSession().getAttribute(CHECK_ALL_SESSIONS_COMPLETED));
LearningUtil learningUtil= new LearningUtil();
- /**
+ /*
* generate a report for the Author/Teacher
*/
logger.debug("calling buidMonitoringReport with toolSessionIdCounter:" + toolSessionIdCounter);
@@ -462,7 +478,7 @@
}
}
- /**
+ /*
* store the arrayList in the session
*/
if (READABLE_TOOL_SESSION_COUNT.equals(MAX_TOOL_SESSION_COUNT))
@@ -496,6 +512,23 @@
return (mapping.findForward(MONITORING_REPORT));
}
+ /**
+ * produces the Instructions screen
+ *
+ * ActionForward generateInstructionsScreen(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward
+ * @throws IOException
+ * @throws ServletException
+ */
public ActionForward generateInstructionsScreen(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -519,7 +552,23 @@
return (mapping.findForward(MONITORING_REPORT));
}
-
+ /**
+ * produces the EditActivity screen
+ *
+ * ActionForward generateEditActivityScreen(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return ActionForward
+ * @throws IOException
+ * @throws ServletException
+ */
public ActionForward generateEditActivityScreen(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -537,10 +586,10 @@
if (toolContentId == null)
{
- /**
- * toolContentId is not available from the toolSessions passed to the monitoring url.
- * in this case, toolContentId must have been passed separetely
- */
+ /*
+ * toolContentId is not available from the toolSessions passed to the monitoring url.
+ * in this case, toolContentId must have been passed separetely
+ */
Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID);
logger.debug("will generateEditActivityScreen: " + monitoredContentId);
@@ -567,7 +616,7 @@
qaMonitoringForm.resetUserAction();
if (studentActivity == false)
{
- /**
+ /*
* forward to Authoring Basic tab
*/
QaStarterAction qaStarterAction = new QaStarterAction();
@@ -590,7 +639,23 @@
}
}
-
+ /**
+ * produces the Stats screen
+ *
+ * ActionForward generateStatsScreen(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
public ActionForward generateStatsScreen(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
@@ -653,7 +718,7 @@
* @param form
* @param request
* @param response
- * @return
+ * @return ActionForward
* @throws IOException
* @throws ServletException
*
@@ -671,10 +736,17 @@
return generateSummaryScreen(mapping, form, request, response);
}
-
+
+ /**
+ * ActionForward handleInstructionsScreen(ActionMapping mapping,ActionForm form, HttpServletRequest request)
+ * @param mapping
+ * @param form
+ * @param request
+ * @return ActionForward
+ */
public ActionForward handleInstructionsScreen(ActionMapping mapping,ActionForm form, HttpServletRequest request)
{
- /**
+ /*
* update online and offline instuctions content if there is a request.
*/
QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form;
@@ -697,7 +769,7 @@
}
else
{
- /**
+ /*
* update the content
*/
logger.debug("content id: " + initialMonitoringContentId);
@@ -720,6 +792,7 @@
/**
* persists error messages to request scope
+ * persistError(HttpServletRequest request, String message)
* @param request
* @param message
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java
===================================================================
diff -u -r5ba75a338c76b23778bf80ab835209d38e2316cb -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java (.../QaMonitoringForm.java) (revision 5ba75a338c76b23778bf80ab835209d38e2316cb)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringForm.java (.../QaMonitoringForm.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -7,7 +7,7 @@
*/
package org.lamsfoundation.lams.tool.qa.web;
-/**
+/*
* ActionForm for the Monitoring environment
*/
import org.apache.log4j.Logger;
@@ -23,14 +23,14 @@
public class QaMonitoringForm extends ActionForm implements QaAppConstants {
static Logger logger = Logger.getLogger(QaMonitoringForm.class.getName());
- /**
- * these buttons are not used in the deployment
+ /*
+ * these buttons are only for development purposes
*/
protected String startLesson;
protected String deleteLesson;
protected String forceComplete;
- /**
+ /*
* buttons
*/
protected String editReport;
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java
===================================================================
diff -u -r3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 3b5a7ca8b9fe39d0ce74e4403356c817aa4a7f86)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -49,7 +49,6 @@
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
@@ -62,9 +61,6 @@
{
QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form;
- /**
- * retrive the service
- */
IQaService qaService=null;
qaService =(IQaService)request.getSession().getAttribute(TOOL_SERVICE);
if (qaService == null)
@@ -75,23 +71,23 @@
}
logger.debug("retrieved qaService: " + qaService);
- /**
+ /*
* persist time zone information to session scope.
*/
QaUtils.persistTimeZone(request);
- /**
+ /*
* mark the http session as an authoring activity
*/
request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_MONITORING);
- /**
+ /*
* obtain and setup the current user's data
*/
String userId = "";
- //get session from shared session.
+ /* get session from shared session. */
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
if ((user == null) || (user.getUserID() == null))
{
@@ -143,7 +139,7 @@
}
logger.debug("final INITIAL_MONITORING_TOOL_CONTENT_ID: " + request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID));
- /**
+ /*
* load the values for online and offline instructions
*/
initialMonitoringContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID);
@@ -156,7 +152,7 @@
logger.debug("session updated with online/offline instructions");
}
- /**
+ /*
* find out if only content id but no tool sessions has been passed
* since with the updated tool contract only userId+toolContentId is passed
* this will always return true
@@ -168,7 +164,7 @@
request.getSession().setAttribute(NO_TOOL_SESSIONS_AVAILABLE, new Boolean(false));
if (isOnlyContentIdAvailable == false)
{
- /**
+ /*
* this block of code will normally never run!
*/
logger.debug("Warning! We are not supposed to reach here!");
@@ -207,13 +203,13 @@
String strFromToolContentId="";
String strToToolContentId="";
- /**
- * simulate Monitoring Service bean by calling the interface methods here
- */
+ /*
+ * simulate Monitoring Service bean by calling the interface methods here
+ */
if (qaMonitoringForm.getStartLesson() != null)
{
qaMonitoringForm.resetUserAction();
- /**
+ /*
* In deployment, we won't be passing FROM_TOOL_CONTENT_ID, TO_TOOL_CONTENT_ID and TOOL_SESSION_ID from url
* the Monitoring Service bean calls:
* copyToolContent(Long fromContentId, Long toContentId)
@@ -234,11 +230,12 @@
}
logger.debug("test successfull: copyToolContent.");
- /** calls to these two methods will be made from Monitoring Service bean optionally depending on
+ /*
+ * calls to these two methods will be made from Monitoring Service bean optionally depending on
* the the tool is setup for DefineLater and (or) RunOffline
*/
- /**
+ /*
* TESTED to work
* qaService.setAsDefineLater(new Long(strToToolContentId));
qaService.setAsRunOffline(new Long(strToToolContentId));
@@ -248,7 +245,7 @@
else if (qaMonitoringForm.getDeleteLesson() != null)
{
qaMonitoringForm.resetUserAction();
- /**
+ /*
* TESTED to work
*/
strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID);
@@ -260,12 +257,12 @@
}
qaService.removeToolContent(new Long(strToToolContentId));
}
- /**
+ /*
*forceComplete is an API call to service bean from monitoring environment with userId as the parameter
*/
else if (qaMonitoringForm.getForceComplete() != null)
{
- /**
+ /*
* Parameter: userId
*/
qaMonitoringForm.resetUserAction();
@@ -275,7 +272,7 @@
qaService.setAsForceComplete(new Long(userId));
logger.debug("end of setAsForceComplete with userId: " + userId);
}
- /**
+ /*
* summary tab is one of the main tabs in monitoring screen, summary is the default tab
*/
else if (qaMonitoringForm.getSummary() != null)
@@ -303,7 +300,11 @@
return null;
}
-
+ /**
+ * boolean isOnlyContentIdAvailable(HttpServletRequest request)
+ * @param request
+ * @return boolean
+ */
public boolean isOnlyContentIdAvailable(HttpServletRequest request)
{
boolean existsContentId=false;
@@ -333,8 +334,13 @@
}
}
+
/**
* verify that toolSession and content is compatible
+ * boolean isToolSessionCompatibleToContent(Long toolContentId, HttpServletRequest request)
+ * @param toolContentId
+ * @param request
+ * @return boolean
*/
public boolean isToolSessionCompatibleToContent(Long toolContentId, HttpServletRequest request)
{
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -r33127f690e04777acb08682f48994e5c102e4967 -re693b778e6201af40e4ea93f2a0d06b5ca5cf462
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 33127f690e04777acb08682f48994e5c102e4967)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision e693b778e6201af40e4ea93f2a0d06b5ca5cf462)
@@ -94,29 +94,33 @@
import org.lamsfoundation.lams.tool.qa.QaUtils;
import org.lamsfoundation.lams.tool.qa.service.IQaService;
import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
import org.lamsfoundation.lams.web.session.SessionManager;
import org.lamsfoundation.lams.web.util.AttributeNames;
-
+/**
+ *
+ * @author Ozgur Demirtas
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ *
+ * A Map data structure is used to present the UI.
+ It is fetched by subsequent Action classes to manipulate its content and gets parsed in the presentation layer for display.
+ */
public class QaStarterAction extends Action implements QaAppConstants {
static Logger logger = Logger.getLogger(QaStarterAction.class.getName());
- /**
- * A Map data structure is used to present the UI.
- * It is fetched by subsequent Action classes to manipulate its content and gets parsed in the presentation layer for display.
- */
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException, QaApplicationException {
Map mapQuestionContent= new TreeMap(new QaComparator());
- /** these two are for repository access */
- /**holds the final offline files list */
+ /* these two are for repository access */
+ /* holds the final offline files list */
LinkedList listUploadedOfflineFiles= new LinkedList();
LinkedList listUploadedOnlineFiles= new LinkedList();
- /** these two are for jsp */
+ /* these two are for jsp */
LinkedList listUploadedOfflineFileNames= new LinkedList();
LinkedList listUploadedOnlineFileNames= new LinkedList();
@@ -131,10 +135,6 @@
request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames);
request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames);
-
- /**
- * retrive the service
- */
IQaService qaService = QaUtils.getToolService(request);
logger.debug("retrieving qaService from session: " + qaService);
if (qaService == null)
@@ -143,16 +143,18 @@
logger.debug("retrieving qaService from proxy: " + qaService);
request.getSession().setAttribute(TOOL_SERVICE, qaService);
}
- /** double check if this is a good place to call */
- /** needs to be called only once. */
- /** QaUtils.configureContentRepository(request); */
+
+ /* double check if this is a good place to call */
+ /* needs to be called only once. */
+ /* QaUtils.configureContentRepository(request); */
- /**
+ /*
* obtain and setup the current user's data
*/
- //get session from shared session.
+
+ /* get session from shared session. */
HttpSession ss = SessionManager.getSession();
- //get back login user DTO
+ /* get back login user DTO */
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
if ((user == null) || (user.getUserID() == null))
{
@@ -162,7 +164,7 @@
return (mapping.findForward(LOAD_QUESTIONS));
}
- /**
+ /*
* retrieve the default content id based on tool signature
*/
long contentId=0;
@@ -187,7 +189,7 @@
return (mapping.findForward(LOAD_QUESTIONS));
}
- /**
+ /*
* retrieve the default question content id based on default content id determined above
*/
try
@@ -202,7 +204,7 @@
persistError(request,"error.defaultQuestionContent.notAvailable");
return (mapping.findForward(LOAD_QUESTIONS));
}
- /**
+ /*
* display a single sample question
*/
request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
@@ -215,12 +217,12 @@
return (mapping.findForward(LOAD_QUESTIONS));
}
- /**
+ /*
* mark the http session as an authoring activity
*/
request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING);
- /**
+ /*
* define tab controllers for jsp
*/
request.getSession().setAttribute(CHOICE_TYPE_BASIC,CHOICE_TYPE_BASIC);
@@ -232,7 +234,7 @@
logger.debug("FORM_INDEX set to: " + request.getSession().getAttribute(FORM_INDEX));
- /**
+ /*
* find out whether the request is coming from monitoring module for EditActivity tab or from authoring environment url
*/
String strToolContentId="";
@@ -252,9 +254,7 @@
{
if (monitoredContentId != null)
{
- /**
- * request is from Edit Activity tab in monitoring
- */
+ /* request is from Edit Activity tab in monitoring */
strToolContentId=monitoredContentId.toString();
logger.debug("request is from Edit Activity tab in monitoring: " + monitoredContentId);
logger.debug("using MONITORED_CONTENT_ID: " + monitoredContentId);
@@ -265,16 +265,14 @@
else
{
logger.debug("will render authoring screen");
- /**
- * request is from authoring environment
- */
+ /* request is from authoring environment */
request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(false));
logger.debug("request is from authoring environment: ");
strToolContentId=request.getParameter(TOOL_CONTENT_ID);
}
logger.debug("usable strToolContentId: " + strToolContentId);
- /**
+ /*
* Process incoming tool content id
* Either exists or not exists in the db yet, a toolContentId must be passed to the tool from the container
*/
@@ -294,7 +292,7 @@
}
- /**
+ /*
* find out if the passed tool content id exists in the db
* present user either a first timer screen with default content data or fetch the existing content.
*
@@ -304,160 +302,219 @@
*/
if (!existsContent(toolContentId, request))
{
- /**
- * get default content from db, user never created any content before
- */
- contentId=qaService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
- logger.debug("getting default content with id:" + contentId);
-
- QaContent defaultQaContent = qaService.retrieveQa(contentId);
- logger.debug("defaultQaContent: " + defaultQaContent);
-
- /**
- * this is a new content creation, the content must always be unlocked
- * CONTENT_LOCKED means CONTENT_IN_USE
- */
- request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(false));
- logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED));
-
- if (defaultQaContent == null)
- {
- logger.debug("Exception occured: No default content");
- request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE, new Boolean(true));
- persistError(request,"error.defaultContent.notAvailable");
- return (mapping.findForward(LOAD_QUESTIONS));
- }
-
- QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm);
- qaAuthoringForm.setUsernameVisible(OFF);
- logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible());
- qaAuthoringForm.setQuestionsSequenced(OFF);
- qaAuthoringForm.setSynchInMonitor(OFF);
-
- mapQuestionContent.clear();
- /**
- * place the default question as the first entry in the Map
- */
- mapQuestionContent.put(INITIAL_QUESTION_COUNT,request.getSession().getAttribute(DEFAULT_QUESTION_CONTENT));
- logger.debug("Map initialized with default contentid to: " + mapQuestionContent);
-
- /** set uploaded offline file names to empty list*/
- List listOfflineFileNames=new LinkedList();
-
- /** set uploaded online file names to empty list*/
- List listOnlineFileNames=new LinkedList();
-
+ /* get default content from db, user never created any content before */
+ logger.debug("retrieve default content: " + toolContentId);
+ return retrieveDefaultContent(request, mapping, qaAuthoringForm, mapQuestionContent);
}
else
{
- /**
+ /*
* fetch the existing content from db, user will be presented with her previously created content data
* Note that the content might have been LOCKED(content in use) if one or more learner has started activities with this content
*/
- logger.debug("getting existing content with id:" + toolContentId);
- QaContent defaultQaContent = qaService.retrieveQa(toolContentId);
- logger.debug("defaultQaContent: " + defaultQaContent);
+ logger.debug("retrieve existing content: " + toolContentId);
+ return retrieveExistingContent(request, mapping, qaAuthoringForm, mapQuestionContent, toolContentId);
+ }
+ }
+
+ /**
+ * returns the default content to jsp
+ * ActionForward retrieveDefaultContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
+ *
+ * @param request
+ * @param mapping
+ * @param qaAuthoringForm
+ * @param mapQuestionContent
+ * @return ActionForward
+ */
+ protected ActionForward retrieveDefaultContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
+ {
+ logger.debug("starting retrieveDefaultContent for toolContentId:");
+ IQaService qaService =QaUtils.getToolService(request);
+
+ long contentId=qaService.getToolDefaultContentIdBySignature(MY_SIGNATURE);
+ logger.debug("getting default content with id:" + contentId);
+
+ QaContent defaultQaContent = qaService.retrieveQa(contentId);
+ logger.debug("defaultQaContent: " + defaultQaContent);
+
+ /*
+ * this is a new content creation, the content must always be unlocked
+ * CONTENT_LOCKED means CONTENT_IN_USE
+ */
+ request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(false));
+ logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED));
+
+ if (defaultQaContent == null)
+ {
+ logger.debug("Exception occured: No default content");
+ request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE, new Boolean(true));
+ persistError(request,"error.defaultContent.notAvailable");
+ return (mapping.findForward(LOAD_QUESTIONS));
+ }
- boolean studentActivity=qaService.studentActivityOccurredGlobal(defaultQaContent);
- logger.debug("studentActivity on content: " + studentActivity);
- if (studentActivity)
+ QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm);
+ qaAuthoringForm.setUsernameVisible(OFF);
+ logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible());
+ qaAuthoringForm.setQuestionsSequenced(OFF);
+ qaAuthoringForm.setSynchInMonitor(OFF);
+
+ mapQuestionContent.clear();
+ /*
+ * place the default question as the first entry in the Map
+ */
+ mapQuestionContent.put(INITIAL_QUESTION_COUNT,request.getSession().getAttribute(DEFAULT_QUESTION_CONTENT));
+ logger.debug("Map initialized with default contentid to: " + mapQuestionContent);
+
+ /* set uploaded offline file names to empty list*/
+ List listOfflineFileNames=new LinkedList();
+
+ /* set uploaded online file names to empty list*/
+ List listOnlineFileNames=new LinkedList();
+
+ logger.debug("callling presentInitialUserInterface for the default content.");
+ return presentInitialUserInterface(request, mapping, qaAuthoringForm, mapQuestionContent);
+ }
+
+
+ /**
+ * retrives the existing content information from the db and prepares the data for presentation purposes.
+ * ActionForward retrieveExistingContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentId)
+ *
+ * @param request
+ * @param mapping
+ * @param qaAuthoringForm
+ * @param mapQuestionContent
+ * @param toolContentId
+ * @return ActionForward
+ */
+ protected ActionForward retrieveExistingContent(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent, long toolContentId)
+ {
+ logger.debug("starting retrieveExistingContent for toolContentId: " + toolContentId);
+ IQaService qaService =QaUtils.getToolService(request);
+
+ logger.debug("getting existing content with id:" + toolContentId);
+ QaContent defaultQaContent = qaService.retrieveQa(toolContentId);
+ logger.debug("defaultQaContent: " + defaultQaContent);
+
+ boolean studentActivity=qaService.studentActivityOccurredGlobal(defaultQaContent);
+ logger.debug("studentActivity on content: " + studentActivity);
+ if (studentActivity)
+ {
+ logger.debug("forward to warning screen as the content is not allowed to be modified.");
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse"));
+ saveErrors(request,errors);
+ request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(true));
+ logger.debug("forwarding to:" + LOAD);
+ return (mapping.findForward(LOAD));
+ }
+
+ request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(isContentLocked(defaultQaContent)));
+ logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED));
+
+ QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm);
+
+ /*
+ * determine the status of radio boxes
+ */
+ logger.debug("IS_USERNAME_VISIBLE: " + defaultQaContent.isUsernameVisible());
+ logger.debug("set UsernameVisible to : " + defaultQaContent.isUsernameVisible());
+ if (defaultQaContent.isUsernameVisible())
+ qaAuthoringForm.setUsernameVisible(ON);
+ else
+ qaAuthoringForm.setUsernameVisible(OFF);
+ logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible());
+ if (defaultQaContent.isSynchInMonitor())
+ qaAuthoringForm.setSynchInMonitor(ON);
+ else
+ qaAuthoringForm.setSynchInMonitor(OFF);
+
+ if (defaultQaContent.isQuestionsSequenced())
+ qaAuthoringForm.setQuestionsSequenced(ON);
+ else
+ qaAuthoringForm.setQuestionsSequenced(OFF);
+
+ request.getSession().setAttribute(IS_USERNAME_VISIBLE_MONITORING, new Boolean(defaultQaContent.isUsernameVisible()));
+ request.getSession().setAttribute(IS_SYNCH_INMONITOR_MONITORING, new Boolean(defaultQaContent.isSynchInMonitor()));
+ request.getSession().setAttribute(IS_QUESTIONS_SEQUENCED_MONITORING,new Boolean(defaultQaContent.isQuestionsSequenced()));
+ request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(defaultQaContent.isDefineLater()));
+ request.getSession().setAttribute(REPORT_TITLE, defaultQaContent.getReportTitle());
+ request.getSession().setAttribute(MONITORING_REPORT_TITLE, defaultQaContent.getMonitoringReportTitle());
+ request.getSession().setAttribute(OFFLINE_INSTRUCTIONS, defaultQaContent.getOfflineInstructions());
+ request.getSession().setAttribute(ONLINE_INSTRUCTIONS, defaultQaContent.getOnlineInstructions());
+ request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS, defaultQaContent.getOfflineInstructions());
+ request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS, defaultQaContent.getOnlineInstructions());
+ request.getSession().setAttribute(RICHTEXT_TITLE, defaultQaContent.getTitle());
+ request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS, defaultQaContent.getInstructions());
+ logger.debug("QaStarter set all 4 rich text properties");
+
+ request.getSession().setAttribute(END_LEARNING_MESSSAGE, defaultQaContent.getEndLearningMessage());
+ request.getSession().setAttribute(CREATION_DATE, defaultQaContent.getCreationDate());
+
+ logger.debug("IS_QUESTIONS_SEQUENCED_MONITORING: " + request.getSession().getAttribute(IS_QUESTIONS_SEQUENCED_MONITORING));
+ logger.debug("IS_DEFINE_LATER: " + request.getSession().getAttribute(IS_DEFINE_LATER));
+
+ QaUtils.populateUploadedFilesData(request, defaultQaContent);
+ logger.debug("populated UploadedFilesData");
+
+ /*
+ * get the existing question content
+ */
+ logger.debug("setting existing content data from the db");
+ mapQuestionContent.clear();
+ Iterator queIterator=defaultQaContent.getQaQueContents().iterator();
+ Long mapIndex=new Long(1);
+ logger.debug("mapQuestionContent: " + mapQuestionContent);
+ while (queIterator.hasNext())
+ {
+ QaQueContent qaQueContent=(QaQueContent) queIterator.next();
+ if (qaQueContent != null)
{
- logger.debug("forward to warning screen as the content is not allowed to be modified.");
- ActionMessages errors= new ActionMessages();
- errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse"));
- saveErrors(request,errors);
- request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(true));
- logger.debug("forwarding to:" + LOAD);
- return (mapping.findForward(LOAD));
+ logger.debug("question: " + qaQueContent.getQuestion());
+ mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion());
+ /**
+ * make the first entry the default(first) one for jsp
+ */
+ if (mapIndex.longValue() == 1)
+ request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
+ mapIndex=new Long(mapIndex.longValue()+1);
}
-
- request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(isContentLocked(defaultQaContent)));
- logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED));
-
- QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm);
-
- /**
- * determine the status of radio boxes
- */
- logger.debug("IS_USERNAME_VISIBLE: " + defaultQaContent.isUsernameVisible());
- logger.debug("set UsernameVisible to : " + defaultQaContent.isUsernameVisible());
- if (defaultQaContent.isUsernameVisible())
- qaAuthoringForm.setUsernameVisible(ON);
- else
- qaAuthoringForm.setUsernameVisible(OFF);
- logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible());
- if (defaultQaContent.isSynchInMonitor())
- qaAuthoringForm.setSynchInMonitor(ON);
- else
- qaAuthoringForm.setSynchInMonitor(OFF);
-
- if (defaultQaContent.isQuestionsSequenced())
- qaAuthoringForm.setQuestionsSequenced(ON);
- else
- qaAuthoringForm.setQuestionsSequenced(OFF);
-
- request.getSession().setAttribute(IS_USERNAME_VISIBLE_MONITORING, new Boolean(defaultQaContent.isUsernameVisible()));
- request.getSession().setAttribute(IS_SYNCH_INMONITOR_MONITORING, new Boolean(defaultQaContent.isSynchInMonitor()));
- request.getSession().setAttribute(IS_QUESTIONS_SEQUENCED_MONITORING,new Boolean(defaultQaContent.isQuestionsSequenced()));
- request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(defaultQaContent.isDefineLater()));
- request.getSession().setAttribute(REPORT_TITLE, defaultQaContent.getReportTitle());
- request.getSession().setAttribute(MONITORING_REPORT_TITLE, defaultQaContent.getMonitoringReportTitle());
- request.getSession().setAttribute(OFFLINE_INSTRUCTIONS, defaultQaContent.getOfflineInstructions());
- request.getSession().setAttribute(ONLINE_INSTRUCTIONS, defaultQaContent.getOnlineInstructions());
- request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS, defaultQaContent.getOfflineInstructions());
- request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS, defaultQaContent.getOnlineInstructions());
- request.getSession().setAttribute(RICHTEXT_TITLE, defaultQaContent.getTitle());
- request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS, defaultQaContent.getInstructions());
- logger.debug("QaStarter set all 4 rich text properties");
-
- request.getSession().setAttribute(END_LEARNING_MESSSAGE, defaultQaContent.getEndLearningMessage());
- request.getSession().setAttribute(CREATION_DATE, defaultQaContent.getCreationDate());
-
- logger.debug("IS_QUESTIONS_SEQUENCED_MONITORING: " + request.getSession().getAttribute(IS_QUESTIONS_SEQUENCED_MONITORING));
- logger.debug("IS_DEFINE_LATER: " + request.getSession().getAttribute(IS_DEFINE_LATER));
-
- QaUtils.populateUploadedFilesData(request, defaultQaContent);
- logger.debug("populated UploadedFilesData");
-
- /**
- * get the existing question content
- */
- logger.debug("setting existing content data from the db");
- mapQuestionContent.clear();
- Iterator queIterator=defaultQaContent.getQaQueContents().iterator();
- Long mapIndex=new Long(1);
- logger.debug("mapQuestionContent: " + mapQuestionContent);
- while (queIterator.hasNext())
- {
- QaQueContent qaQueContent=(QaQueContent) queIterator.next();
- if (qaQueContent != null)
- {
- logger.debug("question: " + qaQueContent.getQuestion());
- mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion());
- /**
- * make the first entry the default(first) one for jsp
- */
- if (mapIndex.longValue() == 1)
- request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion());
- mapIndex=new Long(mapIndex.longValue()+1);
- }
- }
- logger.debug("Map initialized with existing contentid to: " + mapQuestionContent);
}
+ logger.debug("Map initialized with existing contentid to: " + mapQuestionContent);
- request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
- logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
+ logger.debug("callling presentInitialUserInterface for the existing content.");
+ return presentInitialUserInterface(request, mapping, qaAuthoringForm, mapQuestionContent);
+ }
+
+
/**
- * load questions page
+ * presents the final Map to the jsp
+ * ActionForward presentInitialUserInterface(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
+ *
+ * @param request
+ * @param mapping
+ * @param qaAuthoringForm
+ * @param mapQuestionContent
+ * @return
*/
+ protected ActionForward presentInitialUserInterface(HttpServletRequest request, ActionMapping mapping, QaAuthoringForm qaAuthoringForm, Map mapQuestionContent)
+ {
+ logger.debug("starting presentInitialUserInterface...");
+ request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent);
+ logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") );
+
+ /*
+ * load questions page
+ */
+
+ logger.debug("START_MONITORING_SUMMARY_REQUEST: " + request.getAttribute(START_MONITORING_SUMMARY_REQUEST));
+ logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY));
+ qaAuthoringForm.resetUserAction();
+ return (mapping.findForward(LOAD_QUESTIONS));
+ }
- logger.debug("START_MONITORING_SUMMARY_REQUEST: " + request.getAttribute(START_MONITORING_SUMMARY_REQUEST));
- logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY));
- qaAuthoringForm.resetUserAction();
- return (mapping.findForward(LOAD_QUESTIONS));
- }
-
/**
* existsContent(long toolContentId)
* @param long toolContentId
@@ -466,9 +523,6 @@
*/
protected boolean existsContent(long toolContentId, HttpServletRequest request)
{
- /**
- * retrive the service
- */
IQaService qaService =QaUtils.getToolService(request);
QaContent qaContent=qaService.loadQa(toolContentId);
if (qaContent == null)
@@ -480,17 +534,32 @@
/**
* find out if the content is locked or not. If it is a locked content, the author can not modify it.
* The idea of content being locked is, once any one learner starts using a particular content
- * that content should become unmodifiable.
+ * that content should become unmodifiable.
+ * boolean isContentLocked(QaContent qaContent)
* @param qaContent
- * @return
+ * @return boolean
*/
protected boolean isContentLocked(QaContent qaContent)
{
logger.debug("is content locked: " + qaContent.isContentLocked());
return qaContent.isContentLocked();
}
-
+ /**
+ * mark the request scope to generate monitoring summary screen
+ *
+ * ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException, QaApplicationException
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws QaApplicationException
+ */
public ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException, QaApplicationException
{