Index: lams_tool_laqa/conf/hibernate/mappings/QaQueUsr.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/conf/hibernate/mappings/Attic/QaQueUsr.hbm.xml,v diff -u -r1.6 -r1.7 --- lams_tool_laqa/conf/hibernate/mappings/QaQueUsr.hbm.xml 6 Dec 2005 00:31:47 -0000 1.6 +++ lams_tool_laqa/conf/hibernate/mappings/QaQueUsr.hbm.xml 9 Feb 2006 20:02:08 -0000 1.7 @@ -9,13 +9,23 @@ name="org.lamsfoundation.lams.tool.qa.QaQueUsr" table="tl_laqa11_que_usr" > + + + + + - - + - + / --> - + QA Tool for Lams 1.1 - - + + - - - +
+ + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - + + - - + + @@ -73,238 +73,251 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - - - + + + - - + +
- - - +
+ + - - - - + + + - - - + + + + - - - - - + + + + + + + + + + + - - - - + + + + + + + + + + + - - - + + + - - - - - + + + + + - - - + + + - - + + @@ -313,65 +326,65 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + @@ -380,172 +393,172 @@
- - - +
+ + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - + + - - + + - +
- - - +
+ + - - - + + + + - - - - + + + - - - - - + + + + + - - - + + + + - - - - + + + - - - - - + + + + + - - - + + + + - - - - + + + - - + + - - + + Index: lams_tool_laqa/db/sql/create_lams_tool_qa.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/db/sql/create_lams_tool_qa.sql,v diff -u -r1.15 -r1.16 --- lams_tool_laqa/db/sql/create_lams_tool_qa.sql 13 Jan 2006 04:10:03 -0000 1.15 +++ lams_tool_laqa/db/sql/create_lams_tool_qa.sql 9 Feb 2006 20:02:08 -0000 1.16 @@ -1,4 +1,4 @@ -CREATE TABLE tl_laqa11_content ( +CREATE TABLE lams.tl_laqa11_content ( qa_content_id BIGINT(20) NOT NULL , title VARCHAR(250) NOT NULL DEFAULT 'Questions and Answers' , instructions VARCHAR(250) NOT NULL DEFAULT 'Please, take a minute to answer the following questions.' @@ -19,7 +19,7 @@ , PRIMARY KEY (qa_content_id) )TYPE=InnoDB; -CREATE TABLE tl_laqa11_session ( +CREATE TABLE lams.tl_laqa11_session ( qa_session_id BIGINT(20) NOT NULL , session_start_date DATETIME , session_end_date DATETIME @@ -28,32 +28,33 @@ , PRIMARY KEY (qa_session_id) , INDEX (qa_content_id) , CONSTRAINT FK_tl_laqa11_session_1 FOREIGN KEY (qa_content_id) - REFERENCES tl_laqa11_content (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) )TYPE=InnoDB; -CREATE TABLE tl_laqa11_que_usr ( - que_usr_id BIGINT(20) NOT NULL +CREATE TABLE lams.tl_laqa11_que_usr ( + uid BIGINT(20) NOT NULL AUTO_INCREMENT + , que_usr_id BIGINT(20) NOT NULL , username VARCHAR(100) , qa_session_id BIGINT(20) NOT NULL , fullname VARCHAR(100) - , PRIMARY KEY (que_usr_id) + , PRIMARY KEY (uid) , INDEX (qa_session_id) - , CONSTRAINT FK_tl_laqa11_que_usr_2 FOREIGN KEY (qa_session_id) - REFERENCES tl_laqa11_session (qa_session_id) + , CONSTRAINT FK_tl_laqa11_que_usr_1 FOREIGN KEY (qa_session_id) + REFERENCES lams.tl_laqa11_session (qa_session_id) )TYPE=InnoDB; -CREATE TABLE tl_laqa11_que_content ( +CREATE TABLE lams.tl_laqa11_que_content ( qa_que_content_id BIGINT(20) NOT NULL , question VARCHAR(255) , display_order INT(5) , qa_content_id BIGINT(20) NOT NULL , PRIMARY KEY (qa_que_content_id) , INDEX (qa_content_id) , CONSTRAINT FK_tl_laqa11_que_content_1 FOREIGN KEY (qa_content_id) - REFERENCES tl_laqa11_content (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) )TYPE=InnoDB; -CREATE TABLE tl_laqa11_usr_resp ( +CREATE TABLE lams.tl_laqa11_usr_resp ( response_id BIGINT(20) NOT NULL , hidden TINYINT(1) DEFAULT 0 , answer VARCHAR(255) @@ -64,13 +65,13 @@ , PRIMARY KEY (response_id) , INDEX (qa_que_content_id) , CONSTRAINT FK_tl_laqa11_usr_resp_2 FOREIGN KEY (qa_que_content_id) - REFERENCES tl_laqa11_que_content (qa_que_content_id) + REFERENCES lams.tl_laqa11_que_content (qa_que_content_id) , INDEX (que_usr_id) , CONSTRAINT FK_tl_laqa11_usr_resp_3 FOREIGN KEY (que_usr_id) - REFERENCES tl_laqa11_que_usr (que_usr_id) + REFERENCES lams.tl_laqa11_que_usr (uid) )TYPE=InnoDB; -CREATE TABLE tl_laqa11_uploadedFile ( +CREATE TABLE lams.tl_laqa11_uploadedFile ( submissionId BIGINT(20) NOT NULL AUTO_INCREMENT , uuid VARCHAR(255) NOT NULL , isOnline_File TINYINT(1) NOT NULL @@ -79,15 +80,11 @@ , PRIMARY KEY (submissionId) , INDEX (qa_content_id) , CONSTRAINT FK_tl_laqa11_que_content_1_1 FOREIGN KEY (qa_content_id) - REFERENCES tl_laqa11_content (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) )TYPE=InnoDB; - - - -- data for content table 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}); \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/Attic/QaQueUsr.hbm.xml,v diff -u -r1.4 -r1.5 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml 14 Oct 2005 11:55:39 -0000 1.4 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml 9 Feb 2006 20:02:08 -0000 1.5 @@ -9,13 +9,23 @@ name="org.lamsfoundation.lams.tool.qa.QaQueUsr" table="tl_laqa11_que_usr" > + + + + + - - + 0){ + QaQueUsr qu = (QaQueUsr) list.get(0); + return qu; + } + return null; + } + + + public QaQueUsr loadQaQueUsrById(long qaQueUsrId) + { + return getQaQueUsrById(qaQueUsrId); + } + + public void createUsr(QaQueUsr usr) { this.getSession().setFlushMode(FlushMode.AUTO); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java,v diff -u -r1.20 -r1.21 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 7 Feb 2006 23:03:24 -0000 1.20 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java 9 Feb 2006 20:02:08 -0000 1.21 @@ -107,6 +107,8 @@ */ public QaQueUsr retrieveQaQueUsr(long qaQaUsrId); + public QaQueUsr getQaQueUsrById(long qaQueUsrId); + public void updateQa(QaContent qa); public void createQa(QaContent qa); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java,v diff -u -r1.27 -r1.28 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 8 Feb 2006 17:47:26 -0000 1.27 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java 9 Feb 2006 20:02:08 -0000 1.28 @@ -312,8 +312,25 @@ e); } } + + public QaQueUsr getQaQueUsrById(long qaQueUsrId) throws QaApplicationException + { + try + { + QaQueUsr qaQueUsr=qaQueUsrDAO.getQaQueUsrById(qaQueUsrId); + return qaQueUsr; + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is getting qa QueUsr: " + + e.getMessage(), + e); + } + + } + public void createQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException { try Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java,v diff -u -r1.15 -r1.16 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 5 Jan 2006 04:36:32 -0000 1.15 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/LearningUtil.java 9 Feb 2006 20:02:08 -0000 1.16 @@ -41,110 +41,6 @@ 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(AttributeNames.PARAM_TOOL_CONTENT_ID)); -// Long toolContentId=(Long)request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); -// QaContent qaContent=qaService.retrieveQa(toolContentId.longValue()); -// -// logger.debug("retrieving qaContent: " + qaContent); -// Iterator sessionIterator=qaContent.getQaSessions().iterator(); -// while (sessionIterator.hasNext()) -// { -// QaSession qaSession=(QaSession)sessionIterator.next(); -// logger.debug("iterated qaSession : " + qaSession); -// -// Iterator sessionUsersIterator=qaSession.getQaQueUsers().iterator(); -// while (sessionUsersIterator.hasNext()) -// { -// QaQueUsr qaQueUsr=(QaQueUsr) sessionUsersIterator.next(); -// logger.debug("iterated qaQueUsr : " + qaQueUsr); -// -// Iterator sessionUsersResponsesIterator=qaQueUsr.getQaUsrResps().iterator(); -// while (sessionUsersResponsesIterator.hasNext()) -// { -// QaUsrResp qaUsrResp=(QaUsrResp)sessionUsersResponsesIterator.next(); -// logger.debug("iterated qaUsrResp : " + qaUsrResp); -// qaService.removeUserResponse(qaUsrResp); -// logger.debug("removed qaUsrResp : " + qaUsrResp); -// } -// } -// } -// logger.debug("end of deleteSessionUsersAndResponses()"); -// } -// -// -// /** -// * NEVER USED: redundant method. -// * deletes the user of a particular question content and her responses -// * deleteExistingUsersAndResponses(HttpServletRequest request) -// * -// * return void -// * @param request -// */ -// protected void deleteExistingUsersAndResponses(HttpServletRequest request) -// { -// IQaService qaService =QaUtils.getToolService(request); -// /* -// * retrive contentId from the http session -// */ -// logger.debug("attempt retrieving toolContentId: " + request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID)); -// Long toolContentId=(Long)request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); -// QaContent qaContent=qaService.retrieveQa(toolContentId.longValue()); -// -// logger.debug("retrieving qaContent: " + qaContent); -// -// Iterator contentIterator=qaContent.getQaQueContents().iterator(); -// while (contentIterator.hasNext()) -// { -// QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); -// logger.debug("retrieving qaQueContent: " + qaQueContent); -// if (qaQueContent != null) -// { -// Set qaQueUsers=qaQueContent.getQaQueUsers(); -// logger.debug("qaQueUsers size: " + qaQueUsers.size()); -// /* -// * iterate users and delete them -// */ -// Iterator usersIterator=qaQueUsers.iterator(); -// while (usersIterator.hasNext()) -// { -// QaQueUsr qaQueUsr=(QaQueUsr) usersIterator.next(); -// logger.debug("retrieving qaQueUsr: " + qaQueUsr); -// if (qaQueUsr != null) -// { -// Set qaUsrResps=qaQueUsr.getQaUsrResps(); -// logger.debug("retrieving user's all responses : " + qaUsrResps); -// Iterator responsesIterator=qaUsrResps.iterator(); -// while (responsesIterator.hasNext()) -// { -// QaUsrResp qaUsrResp=(QaUsrResp)responsesIterator.next(); -// if (qaUsrResp != null) -// { -// logger.debug("retrieving qaUsrResp: " + qaUsrResp); -// qaService.removeUserResponse(qaUsrResp); -// logger.debug("removed qaUsrResp with id:" + qaUsrResp.getResponseId()); -// } -// } -// qaService.deleteQaQueUsr(qaQueUsr); -// logger.debug("deleted user: " + qaQueUsr); -// } -// } -// } -// } -// logger.debug("end of deleteExistingUsersAndResponses()"); -// } - - /** * createUsersAndResponses(Map mapAnswers, HttpServletRequest request) * create users of the responses @@ -201,11 +97,21 @@ new TreeSet()); logger.debug("createQaQueUsr - qaQueUsr: " + qaQueUsr); - if (qaQueUsr != null) + + /*note that it is possible for a user to already exist from another tool session. In this case don't add any more user record*/ + QaQueUsr qaQueUsrLocal=qaService.getQaQueUsrById(userId.longValue()); + logger.debug("qaQueUsrLocal: " + qaQueUsrLocal); + + if ((qaQueUsr != null) && (qaQueUsrLocal == null)) { qaService.createQaQueUsr(qaQueUsr); logger.debug("createUsers-qaQueUsr created in the db: " + qaQueUsr); } + else + { + logger.debug("assign user"); + qaQueUsr=qaQueUsrLocal; + } while (contentIterator.hasNext()) { @@ -232,6 +138,7 @@ String timezoneId=(String)request.getSession().getAttribute(TIMEZONE_ID); if (timezoneId == null) timezoneId=""; + QaUsrResp qaUsrResp= new QaUsrResp(answer,false, new Date(System.currentTimeMillis()), timezoneId, Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/Attic/MonitoringUtil.java,v diff -u -r1.10 -r1.11 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java 5 Jan 2006 04:36:32 -0000 1.10 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/MonitoringUtil.java 9 Feb 2006 20:02:08 -0000 1.11 @@ -6,13 +6,10 @@ import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; -import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.qa.QaAppConstants; -import org.lamsfoundation.lams.tool.qa.QaApplicationException; import org.lamsfoundation.lams.tool.qa.QaContent; import org.lamsfoundation.lams.tool.qa.QaSession; import org.lamsfoundation.lams.tool.qa.QaUsrResp; -import org.lamsfoundation.lams.tool.qa.QaUtils; import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.web.util.AttributeNames; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java,v diff -u -r1.28 -r1.29 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 8 Feb 2006 17:47:26 -0000 1.28 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java 9 Feb 2006 20:02:08 -0000 1.29 @@ -101,6 +101,8 @@ * * 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. + + NOTE: You have to keep in mind that once user can have multiple tool session ids. */ public class QaStarterAction extends Action implements QaAppConstants { static Logger logger = Logger.getLogger(QaStarterAction.class.getName()); Index: lams_tool_laqa/test/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/test/java/org/lamsfoundation/lams/tool/qa/Attic/QaQueUsr.hbm.xml,v diff -u -r1.9 -r1.10 --- lams_tool_laqa/test/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml 6 Dec 2005 00:32:38 -0000 1.9 +++ lams_tool_laqa/test/java/org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml 9 Feb 2006 20:02:07 -0000 1.10 @@ -9,13 +9,23 @@ name="org.lamsfoundation.lams.tool.qa.QaQueUsr" table="tl_laqa11_que_usr" > + + + + + - - + - + / --> - - + + @@ -47,72 +47,73 @@ - + + + + - - + - - - - - - - - - - - - - + + + + + + Index: lams_tool_laqa/web/WEB-INF/QaContent.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/Attic/QaContent.hbm.xml,v diff -u -r1.3 -r1.4 --- lams_tool_laqa/web/WEB-INF/QaContent.hbm.xml 21 Jul 2005 06:59:26 -0000 1.3 +++ lams_tool_laqa/web/WEB-INF/QaContent.hbm.xml 9 Feb 2006 20:02:07 -0000 1.4 @@ -1,17 +1,13 @@ + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > @@ -57,8 +47,6 @@ @@ -67,8 +55,6 @@ - - - Index: lams_tool_laqa/web/WEB-INF/QaQueContent.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/Attic/QaQueContent.hbm.xml,v diff -u -r1.3 -r1.4 --- lams_tool_laqa/web/WEB-INF/QaQueContent.hbm.xml 29 Jun 2005 01:26:50 -0000 1.3 +++ lams_tool_laqa/web/WEB-INF/QaQueContent.hbm.xml 9 Feb 2006 20:02:07 -0000 1.4 @@ -1,16 +1,12 @@ + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > - - - - - Index: lams_tool_laqa/web/WEB-INF/QaQueUsr.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/Attic/QaQueUsr.hbm.xml,v diff -u -r1.2 -r1.3 --- lams_tool_laqa/web/WEB-INF/QaQueUsr.hbm.xml 28 Jun 2005 07:24:55 -0000 1.2 +++ lams_tool_laqa/web/WEB-INF/QaQueUsr.hbm.xml 9 Feb 2006 20:02:07 -0000 1.3 @@ -1,21 +1,31 @@ + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > + + + + + - - + + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > - + / --> + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" > @@ -28,8 +28,6 @@ @@ -75,6 +73,7 @@ - Index: lams_tool_laqa/web/WEB-INF/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/struts-config.xml,v diff -u -r1.7 -r1.8 --- lams_tool_laqa/web/WEB-INF/struts-config.xml 8 Feb 2006 17:47:26 -0000 1.7 +++ lams_tool_laqa/web/WEB-INF/struts-config.xml 9 Feb 2006 20:02:07 -0000 1.8 @@ -100,27 +100,7 @@ redirect="true" /> - - - - - - -