Index: lams_tool_assessment/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/.classpath,v diff -u -r1.2 -r1.2.4.1 --- lams_tool_assessment/.classpath 20 Feb 2009 07:05:03 -0000 1.2 +++ lams_tool_assessment/.classpath 30 Jun 2009 03:04:47 -0000 1.2.4.1 @@ -3,13 +3,16 @@ - - - - + + + + + + + Index: lams_tool_assessment/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/WEB-INF/web.xml,v diff -u -r1.4 -r1.4.2.1 --- lams_tool_assessment/web/WEB-INF/web.xml 26 Mar 2009 19:07:06 -0000 1.4 +++ lams_tool_assessment/web/WEB-INF/web.xml 30 Jun 2009 03:04:48 -0000 1.4.2.1 @@ -9,13 +9,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.assessment.ApplicationResources + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/assessment/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey @@ -213,10 +218,10 @@ - - Secure Content + + Secure Content /* - + LEARNER TEACHER @@ -229,61 +234,61 @@ - - Authoring Update + + Authoring Update /authoring/* - + AUTHOR AUTHOR ADMIN SYSADMIN - - Staff Content + + Staff Content /monitoring.do - + MONITOR TEACHER - - Staff Content + + Staff Content /definelater.do - + MONITOR TEACHER - - Adminstrator Content + + Adminstrator Content /admin.do - + ADMIN - - LAMS System Adminstrator Content + + LAMS System Adminstrator Content /sysadmin.do - + SYSADMIN - - Download Files + + Download Files /download/ - + LEARNER AUTHOR Index: lams_tool_chat/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/.classpath,v diff -u -r1.7 -r1.7.6.1 --- lams_tool_chat/.classpath 30 Oct 2008 03:48:30 -0000 1.7 +++ lams_tool_chat/.classpath 30 Jun 2009 03:04:53 -0000 1.7.6.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_chat/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/conf/xdoclet/web-settings.xml,v diff -u -r1.8 -r1.8.2.1 --- lams_tool_chat/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:37 -0000 1.8 +++ lams_tool_chat/conf/xdoclet/web-settings.xml 30 Jun 2009 03:04:55 -0000 1.8.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.chat.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/chat/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java,v diff -u -r1.6 -r1.6.6.1 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java 27 Oct 2008 03:31:23 -0000 1.6 +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/dao/hibernate/ChatMessageDAO.java 30 Jun 2009 03:04:57 -0000 1.6.6.1 @@ -107,7 +107,7 @@ Map resultMap = new HashMap(); for (Iterator iter = list.iterator(); iter.hasNext();) { Object[] row = (Object[]) iter.next(); - resultMap.put((Long) row[0], (Integer) row[1]); + resultMap.put((Long) row[0], ((Number) row[1]).intValue()); } return resultMap; } @@ -119,7 +119,7 @@ Map resultMap = new HashMap(); for (Iterator iter = list.iterator(); iter.hasNext();) { Object[] row = (Object[]) iter.next(); - resultMap.put((Long) row[0], (Integer) row[1]); + resultMap.put((Long) row[0], ((Number) row[1]).intValue()); } return resultMap; } Index: lams_tool_daco/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/.classpath,v diff -u -r1.6 -r1.6.6.1 --- lams_tool_daco/.classpath 30 Oct 2008 03:48:31 -0000 1.6 +++ lams_tool_daco/.classpath 30 Jun 2009 03:05:03 -0000 1.6.6.1 @@ -3,12 +3,15 @@ - - - + + + + + + - + Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dao/hibernate/DacoAnswerDAOHibernate.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dao/hibernate/DacoAnswerDAOHibernate.java,v diff -u -r1.5 -r1.5.6.1 --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dao/hibernate/DacoAnswerDAOHibernate.java 14 Nov 2008 04:05:26 -0000 1.5 +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/dao/hibernate/DacoAnswerDAOHibernate.java 30 Jun 2009 03:05:05 -0000 1.5.6.1 @@ -95,8 +95,8 @@ QuestionSummarySingleAnswerDTO singleAnswer = new QuestionSummarySingleAnswerDTO(); singleAnswer.setAnswer(row[DacoConstants.QUESTION_DB_ANSWER_ENUMERATION_SUMMARY_ANSWER]); singleAnswer.setCount(row[DacoConstants.QUESTION_DB_ANSWER_ENUMERATION_SUMMARY_COUNT]); - Integer answerCount = (Integer) getHibernateTemplate().find(DacoAnswerDAOHibernate.FIND_ANSWER_COUNT, - currentUid).get(0); + Long answerCount = (Long) getHibernateTemplate().find(DacoAnswerDAOHibernate.FIND_ANSWER_COUNT, currentUid) + .get(0); singleAnswer.setAverage(Math.round(Float.parseFloat(singleAnswer.getCount()) / answerCount * 100) + "%"); if (Short.parseShort(row[DacoConstants.QUESTION_DB_ANSWER_ENUMERATION_SUMMARY_QUESTION_TYPE]) == DacoConstants.QUESTION_TYPE_NUMBER) { @@ -154,11 +154,12 @@ } public Integer getGroupRecordCount(Long sessionId) { - return (Integer) getHibernateTemplate().find(DacoAnswerDAOHibernate.FIND_TOTAL_RECORD_COUNT, sessionId).get(0); + return ((Number) getHibernateTemplate().find(DacoAnswerDAOHibernate.FIND_TOTAL_RECORD_COUNT, sessionId).get(0)) + .intValue(); } public Integer getUserRecordCount(Long userId, Long sessionId) { - return (Integer) getHibernateTemplate().findByNamedParam(DacoAnswerDAOHibernate.FIND_USER_RECORD_COUNT, - new String[] { "userId", "sessionId" }, new Object[] { userId, sessionId }).get(0); + return ((Number) getHibernateTemplate().findByNamedParam(DacoAnswerDAOHibernate.FIND_USER_RECORD_COUNT, + new String[] { "userId", "sessionId" }, new Object[] { userId, sessionId }).get(0)).intValue(); } } \ No newline at end of file Index: lams_tool_daco/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/WEB-INF/web.xml,v diff -u -r1.6 -r1.6.2.1 --- lams_tool_daco/web/WEB-INF/web.xml 26 Mar 2009 10:00:37 -0000 1.6 +++ lams_tool_daco/web/WEB-INF/web.xml 30 Jun 2009 03:05:09 -0000 1.6.2.1 @@ -9,13 +9,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.daco.ApplicationResources + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/daco/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java,v diff -u -r1.9.6.1 -r1.9.6.2 --- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java 29 Apr 2009 06:10:33 -0000 1.9.6.1 +++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddWebAppToApplicationXmlTask.java 30 Jun 2009 03:05:16 -0000 1.9.6.2 @@ -26,78 +26,55 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Task to add a web application entry to an EAR application XML + * * @author chris */ -public class AddWebAppToApplicationXmlTask extends UpdateApplicationXmlTask -{ - - - +public class AddWebAppToApplicationXmlTask extends UpdateApplicationXmlTask { + /** Creates a new instance of AddWebAppToApplicationXmlTask */ - public AddWebAppToApplicationXmlTask() - { + public AddWebAppToApplicationXmlTask() { } - + /** * Add the web uri and context root elements ot the Application xml */ - protected void updateApplicationXml(Document doc) throws DeployException - { - - //find & remove web uri element - Element moduleElement = findElementWithWebURI(doc); - if ( moduleElement != null ) { - doc.getDocumentElement().removeChild(moduleElement); - } + @Override + protected void updateApplicationXml(Document doc) throws DeployException { - //create new module - moduleElement = doc.createElement("module"); - Element webElement = doc.createElement("web"); - moduleElement.appendChild(webElement); - //create new web-uri element in the web element - Element webUriElement = doc.createElement("web-uri"); - webUriElement.appendChild(doc.createTextNode(webUri)); - webElement.appendChild(webUriElement); - - //create new context root element in the web element - Element contextRootElement = doc.createElement("context-root"); - contextRootElement.appendChild(doc.createTextNode(contextRoot)); - webElement.appendChild(contextRootElement); - - doc.getDocumentElement().appendChild(moduleElement); - + // find & remove web uri element + Element moduleElement = findElementWithWebURI(doc); + if (moduleElement != null) { + doc.getDocumentElement().removeChild(moduleElement); + } + + // create new module + moduleElement = doc.createElement("module"); + Element webElement = doc.createElement("web"); + moduleElement.appendChild(webElement); + // create new web-uri element in the web element + Element webUriElement = doc.createElement("web-uri"); + webUriElement.appendChild(doc.createTextNode(webUri)); + webElement.appendChild(webUriElement); + + // create new context root element in the web element + Element contextRootElement = doc.createElement("context-root"); + contextRootElement.appendChild(doc.createTextNode(contextRoot)); + webElement.appendChild(contextRootElement); + + // insert new module in the correct position, before "security-role" elements + + NodeList docNodes = doc.getDocumentElement().getChildNodes(); + for (int nodeIndex = 0; nodeIndex < docNodes.getLength(); nodeIndex++) { + Node node = docNodes.item(nodeIndex); + if ("security-role".equalsIgnoreCase(node.getNodeName())) { + doc.getDocumentElement().insertBefore(moduleElement, node); + break; + } + } } - - /** - * Add the given web app to the application.xml file - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception - { - - if ((args.length < 3) || (args[0] == null)) - { - throw new IllegalArgumentException("Usage: AddModuleToApplicationXmlTask "); - } - try - { - System.out.println("Attempting to update " + args[0] + "/META-INF/application.xml"); - AddWebAppToApplicationXmlTask addModuleTask = new AddWebAppToApplicationXmlTask(); - addModuleTask.setLamsEarPath(args[0]); - addModuleTask.setWebUri(args[1]); - addModuleTask.setContextRoot(args[2]); - addModuleTask.execute(); - System.out.println("application.xml update completed"); - } - catch (Exception ex) - { - System.out.println("Application.xml update failed: " + ex.getMessage()); - ex.printStackTrace(); - } - } - -} +} \ No newline at end of file Index: lams_tool_dimdim/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_dimdim/.classpath,v diff -u -r1.2 -r1.2.6.1 --- lams_tool_dimdim/.classpath 12 Sep 2008 08:05:49 -0000 1.2 +++ lams_tool_dimdim/.classpath 30 Jun 2009 03:05:20 -0000 1.2.6.1 @@ -3,12 +3,11 @@ - - - - - - - + + + + + + Index: lams_tool_dimdim/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_dimdim/conf/xdoclet/Attic/web-settings.xml,v diff -u -r1.3 -r1.3.2.1 --- lams_tool_dimdim/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:37 -0000 1.3 +++ lams_tool_dimdim/conf/xdoclet/web-settings.xml 30 Jun 2009 03:05:23 -0000 1.3.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.dimdim.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/dimdim/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_forum/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/.classpath,v diff -u -r1.14.4.1 -r1.14.4.2 --- lams_tool_forum/.classpath 22 Apr 2009 08:41:38 -0000 1.14.4.1 +++ lams_tool_forum/.classpath 30 Jun 2009 03:05:30 -0000 1.14.4.2 @@ -4,15 +4,17 @@ - - - - - + + + + + + + Index: lams_tool_forum/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/build.xml,v diff -u -r1.55 -r1.55.4.1 --- lams_tool_forum/build.xml 21 Jan 2009 08:49:49 -0000 1.55 +++ lams_tool_forum/build.xml 30 Jun 2009 03:05:31 -0000 1.55.4.1 @@ -102,11 +102,14 @@ + Index: lams_tool_forum/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/xdoclet/web-settings.xml,v diff -u -r1.12 -r1.12.2.1 --- lams_tool_forum/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:37 -0000 1.12 +++ lams_tool_forum/conf/xdoclet/web-settings.xml 30 Jun 2009 03:05:33 -0000 1.12.2.1 @@ -9,13 +9,17 @@ + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/forum/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/MessageSeqDao.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/MessageSeqDao.java,v diff -u -r1.5 -r1.5.6.1 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/MessageSeqDao.java 9 May 2008 04:21:31 -0000 1.5 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/persistence/MessageSeqDao.java 30 Jun 2009 03:05:36 -0000 1.5.6.1 @@ -21,7 +21,7 @@ * **************************************************************** */ -/* $$Id$$ */ +/* $$Id$$ */ package org.lamsfoundation.lams.tool.forum.persistence; @@ -30,42 +30,44 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class MessageSeqDao extends HibernateDaoSupport { - private static final String SQL_QUERY_FIND_TOPIC_THREAD = "from " + MessageSeq.class.getName() - + " where root_message_uid = ?"; - private static final String SQL_QUERY_FIND_TOPIC_ID = "from " + MessageSeq.class.getName() - + " where message_uid = ?"; - - private static final String SQL_QUERY_NUM_POSTS_BY_TOPIC = "select count(*) from " - + MessageSeq.class.getName() + " ms where ms.message.createdBy.userId=? and ms.message.isAuthored = false and ms.rootMessage=?"; - - public List getTopicThread(Long rootTopicId) { - return this.getHibernateTemplate().find(SQL_QUERY_FIND_TOPIC_THREAD,rootTopicId); - } + private static final String SQL_QUERY_FIND_TOPIC_THREAD = "from " + MessageSeq.class.getName() + + " where root_message_uid = ?"; + private static final String SQL_QUERY_FIND_TOPIC_ID = "from " + MessageSeq.class.getName() + + " where message_uid = ?"; - public MessageSeq getByTopicId(Long messageId) { - List list = this.getHibernateTemplate().find(SQL_QUERY_FIND_TOPIC_ID,messageId); - if(list == null || list.isEmpty()) - return null; - return (MessageSeq) list.get(0); + private static final String SQL_QUERY_NUM_POSTS_BY_TOPIC = "select count(*) from " + MessageSeq.class.getName() + + " ms where ms.message.createdBy.userId=? and ms.message.isAuthored = false and ms.rootMessage.uid=?"; + + public List getTopicThread(Long rootTopicId) { + return this.getHibernateTemplate().find(SQL_QUERY_FIND_TOPIC_THREAD, rootTopicId); + } + + public MessageSeq getByTopicId(Long messageId) { + List list = this.getHibernateTemplate().find(SQL_QUERY_FIND_TOPIC_ID, messageId); + if (list == null || list.isEmpty()) { + return null; } + return (MessageSeq) list.get(0); + } - public void save(MessageSeq msgSeq) { - this.getHibernateTemplate().save(msgSeq); + public void save(MessageSeq msgSeq) { + this.getHibernateTemplate().save(msgSeq); + } + + public void deleteByTopicId(Long topicUid) { + MessageSeq seq = getByTopicId(topicUid); + if (seq != null) { + this.getHibernateTemplate().delete(seq); } + } - public void deleteByTopicId(Long topicUid) { - MessageSeq seq = getByTopicId(topicUid); - if(seq != null) - this.getHibernateTemplate().delete(seq); + public int getNumOfPostsByTopic(Long userID, Long topicID) { + List list = this.getHibernateTemplate().find(SQL_QUERY_NUM_POSTS_BY_TOPIC, new Object[] { userID, topicID }); + if (list != null && list.size() > 0) { + return ((Number) list.get(0)).intValue(); + } else { + return 0; } - - public int getNumOfPostsByTopic(Long userID, Long topicID) { - List list = this.getHibernateTemplate().find(SQL_QUERY_NUM_POSTS_BY_TOPIC, new Object[]{userID,topicID}); - if(list != null && list.size() > 0) - return ((Number)list.get(0)).intValue(); - else - return 0; - } + } - } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java,v diff -u -r1.99.4.3 -r1.99.4.4 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 1 May 2009 06:13:56 -0000 1.99.4.3 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java 30 Jun 2009 03:05:36 -0000 1.99.4.4 @@ -250,7 +250,7 @@ MessageSeq msgSeq = messageSeqDao.getByTopicId(message.getUid()); Message root = msgSeq.getRootMessage(); // update reply date - //messageDao.saveOrUpdate(root); // do not update date of root posting + // messageDao.saveOrUpdate(root); // do not update date of root posting return message; } @@ -332,7 +332,7 @@ root.setLastReplyDate(new Date()); // update reply message number for root root.setReplyNumber(root.getReplyNumber() + 1); - //messageDao.saveOrUpdate(root); // do not update the date of root posting + // messageDao.saveOrUpdate(root); // do not update the date of root posting return replyMessage; } @@ -358,8 +358,8 @@ } /** - * This method deletes the content with the given uuid and - * versionID from the content repository + * This method deletes the content with the given uuid and versionID from the content + * repository * * @param uuid * The uuid of the node to be deleted @@ -554,7 +554,7 @@ } } - List users = (List) getUsersBySessionId(sessionID); + List users = getUsersBySessionId(sessionID); if (users != null) { for (ForumUser user : users) { // send marks to gradebook where applicable @@ -625,12 +625,11 @@ } /** - * This method verifies the credentials of the SubmitFiles Tool and gives it - * the Ticket to login and access the Content Repository. + * This method verifies the credentials of the SubmitFiles Tool and gives it the Ticket to login and + * access the Content Repository. * - * A valid ticket is needed in order to access the content from the - * repository. This method would be called evertime the tool needs to - * upload/download files from the content repository. + * A valid ticket is needed in order to access the content from the repository. This method would be called evertime + * the tool needs to upload/download files from the content repository. * * @return ITicket The ticket for repostory access * @throws SubmitFilesException @@ -759,8 +758,7 @@ } /** - * Export the XML fragment for the tool's content, along with any files - * needed for the content. + * Export the XML fragment for the tool's content, along with any files needed for the content. * * @throws DataMissingException * if no tool content matches the toolSessionId @@ -807,8 +805,7 @@ } /** - * Import the XML fragment for the tool's content, along with any files - * needed for the content. + * Import the XML fragment for the tool's content, along with any files needed for the content. * * @throws ToolException * if any other error occurs @@ -860,14 +857,12 @@ } /** - * Get the definitions for possible output for an activity, based on the - * toolContentId. These may be definitions that are always available for the - * tool (e.g. number of marks for Multiple Choice) or a custom definition - * created for a particular activity such as the answer to the third - * question contains the word Koala and hence the need for the toolContentId + * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions + * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created + * for a particular activity such as the answer to the third question contains the word Koala and hence the need for + * the toolContentId * - * @return SortedMap of ToolOutputDefinitions with the key being the name of - * each definition + * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition */ public SortedMap getToolOutputDefinitions(Long toolContentId) throws ToolException { Forum forum = getForumByContentId(toolContentId); @@ -878,8 +873,8 @@ } /** - * @see org.lamsfoundation.lams.tool.ToolSessionManager#createToolSession(java.lang.Long, - * java.lang.String, java.lang.Long) + * @see org.lamsfoundation.lams.tool.ToolSessionManager#createToolSession(java.lang.Long, java.lang.String, + * java.lang.Long) */ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { ForumToolSession session = new ForumToolSession(); @@ -947,8 +942,8 @@ /** * Get the tool output for the given tool output names. * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, - * java.lang.Long, java.lang.Long) + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, + * java.lang.Long) */ public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { @@ -959,8 +954,8 @@ /** * Get the tool output for the given tool output name. * - * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, - * java.lang.Long, java.lang.Long) + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, + * java.lang.Long) */ public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) { return forumOutputFactory.getToolOutput(name, this, toolSessionId, learnerId); @@ -1121,8 +1116,7 @@ } /** - * Set the description, throws away the title value as this is not supported - * in 2.0 + * Set the description, throws away the title value as this is not supported in 2.0 */ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, DataMissingException { @@ -1139,13 +1133,14 @@ /** * Sends marks straight to gradebook from a forum report + * * @param user * @param toolSessionID */ @SuppressWarnings("unchecked") public void sendMarksToGradebook(ForumUser user, Long toolSessionID) { - List messages = (List) getMessagesByUserUid(user.getUid(), toolSessionID); + List messages = getMessagesByUserUid(user.getUid(), toolSessionID); if (messages != null) { Float totalMark = null; for (MessageDTO message : messages) { Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java,v diff -u -r1.65 -r1.65.4.1 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 2 Feb 2009 03:21:24 -0000 1.65 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java 30 Jun 2009 03:05:38 -0000 1.65.4.1 @@ -47,7 +47,6 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; -import org.hibernate.Session; import org.lamsfoundation.lams.events.IEventNotificationService; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; @@ -64,7 +63,6 @@ import org.lamsfoundation.lams.tool.forum.persistence.Message; import org.lamsfoundation.lams.tool.forum.persistence.PersistenceException; import org.lamsfoundation.lams.tool.forum.persistence.Timestamp; -import org.lamsfoundation.lams.tool.forum.service.ForumService; import org.lamsfoundation.lams.tool.forum.service.ForumServiceProxy; import org.lamsfoundation.lams.tool.forum.service.IForumService; import org.lamsfoundation.lams.tool.forum.util.ForumConstants; @@ -82,955 +80,946 @@ * User: conradb Date: 24/06/2005 Time: 10:54:09 */ public class LearningAction extends Action { - private static Logger log = Logger.getLogger(LearningAction.class); + private static Logger log = Logger.getLogger(LearningAction.class); - private static final boolean MODE_OPTIONAL = false; + private static final boolean MODE_OPTIONAL = false; - private IForumService forumService; + private IForumService forumService; - @Override - public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws Exception { - String param = mapping.getParameter(); - // --------------Forum Level ------------------ - if (param.equals("viewForum")) { - return viewForum(mapping, form, request, response); - } - if (param.equals("finish")) { - return finish(mapping, form, request, response); - } + @Override + public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { + String param = mapping.getParameter(); + // --------------Forum Level ------------------ + if (param.equals("viewForum")) { + return viewForum(mapping, form, request, response); + } + if (param.equals("finish")) { + return finish(mapping, form, request, response); + } - // --------------Topic Level ------------------ - if (param.equals("viewTopic")) { - return viewTopic(mapping, form, request, response); - } - if (param.equals("newTopic")) { - return newTopic(mapping, form, request, response); - } - if (param.equals("createTopic")) { - return createTopic(mapping, form, request, response); - } - if (param.equals("newReplyTopic")) { - return newReplyTopic(mapping, form, request, response); - } - if (param.equals("replyTopic")) { - return replyTopic(mapping, form, request, response); - } - if (param.equals("editTopic")) { - return editTopic(mapping, form, request, response); - } - if (param.equals("updateTopic")) { - return updateTopic(mapping, form, request, response); - } - if (param.equals("deleteAttachment")) { - return deleteAttachment(mapping, form, request, response); - } - if (param.equals("updateMessageHideFlag")) { - return updateMessageHideFlag(mapping, form, request, response); - } + // --------------Topic Level ------------------ + if (param.equals("viewTopic")) { + return viewTopic(mapping, form, request, response); + } + if (param.equals("newTopic")) { + return newTopic(mapping, form, request, response); + } + if (param.equals("createTopic")) { + return createTopic(mapping, form, request, response); + } + if (param.equals("newReplyTopic")) { + return newReplyTopic(mapping, form, request, response); + } + if (param.equals("replyTopic")) { + return replyTopic(mapping, form, request, response); + } + if (param.equals("editTopic")) { + return editTopic(mapping, form, request, response); + } + if (param.equals("updateTopic")) { + return updateTopic(mapping, form, request, response); + } + if (param.equals("deleteAttachment")) { + return deleteAttachment(mapping, form, request, response); + } + if (param.equals("updateMessageHideFlag")) { + return updateMessageHideFlag(mapping, form, request, response); + } - //================ Reflection ======================= - if (param.equals("newReflection")) { - return newReflection(mapping, form, request, response); - } - if (param.equals("submitReflection")) { - return submitReflection(mapping, form, request, response); - } - - return mapping.findForward("error"); + // ================ Reflection ======================= + if (param.equals("newReflection")) { + return newReflection(mapping, form, request, response); } + if (param.equals("submitReflection")) { + return submitReflection(mapping, form, request, response); + } - // ========================================================================================== - // Forum level methods - // ========================================================================================== - /** - * Display root topics of a forum. This page will be the initial page of - * Learner page. - * @throws Exception - * - */ - private ActionForward viewForum(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws Exception { + return mapping.findForward("error"); + } - //initial Session Map - String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap; - //refresh forum page, not initial enter - if (sessionMapID != null) { - sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - } - else { - sessionMap = new SessionMap(); - request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + // ========================================================================================== + // Forum level methods + // ========================================================================================== + /** + * Display root topics of a forum. This page will be the initial page of Learner page. + * + * @throws Exception + * + */ + private ActionForward viewForum(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { - } - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + // initial Session Map + String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap; + // refresh forum page, not initial enter + if (sessionMapID != null) { + sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + } else { + sessionMap = new SessionMap(); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - // set the mode into http session - ToolAccessMode mode = null; - try { - mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, LearningAction.MODE_OPTIONAL); - } - catch (Exception exp) { - } - if (mode == null) { - //set it as default mode - mode = ToolAccessMode.LEARNER; - } + } + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); - // get sessionId from HttpServletRequest - Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + // set the mode into http session + ToolAccessMode mode = null; + try { + mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, LearningAction.MODE_OPTIONAL); + } catch (Exception exp) { + } + if (mode == null) { + // set it as default mode + mode = ToolAccessMode.LEARNER; + } - // Try to get ForumID according to sessionId - forumService = getForumManager(); - ForumToolSession session = forumService.getSessionBySessionId(sessionId); + // get sessionId from HttpServletRequest + Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - if (session == null || session.getForum() == null) { - LearningAction.log.error("Failed on getting session by given sessionID:" + sessionId); - throw new Exception("Failed on getting session by given sessionID:" + sessionId); - } + // Try to get ForumID according to sessionId + forumService = getForumManager(); + ForumToolSession session = forumService.getSessionBySessionId(sessionId); - Forum forum = session.getForum(); - //lock on finish - ForumUser forumUser = getCurrentUser(request, sessionId); - boolean lock = forum.getLockWhenFinished() && forumUser.isSessionFinished(); + if (session == null || session.getForum() == null) { + LearningAction.log.error("Failed on getting session by given sessionID:" + sessionId); + throw new Exception("Failed on getting session by given sessionID:" + sessionId); + } - //set some option flag to HttpSession - // if allowRichEditor = true then don't restrict the number of chars - // if isLimitedInput = false then don't restrict the number of chars - // Indicate don't restrict number of chars by allowNumber = 0 - Long forumId = forum.getUid(); - Boolean allowRichEditor = new Boolean(forum.isAllowRichEditor()); - int allowNumber = forum.isLimitedInput() || forum.isAllowRichEditor() ? forum.getLimitedChar() : 0; + Forum forum = session.getForum(); + // lock on finish + ForumUser forumUser = getCurrentUser(request, sessionId); + boolean lock = forum.getLockWhenFinished() && forumUser.isSessionFinished(); - sessionMap.put(ForumConstants.FORUM_ID, forumId); - sessionMap.put(AttributeNames.ATTR_MODE, mode); - sessionMap.put(ForumConstants.ATTR_FINISHED_LOCK, new Boolean(lock)); - sessionMap.put(ForumConstants.ATTR_LOCK_WHEN_FINISHED, forum.getLockWhenFinished()); - sessionMap.put(ForumConstants.ATTR_USER_FINISHED, forumUser.isSessionFinished()); - sessionMap.put(ForumConstants.ATTR_ALLOW_EDIT, forum.isAllowEdit()); - sessionMap.put(ForumConstants.ATTR_ALLOW_UPLOAD, forum.isAllowUpload()); - sessionMap.put(ForumConstants.ATTR_ALLOW_NEW_TOPICS, forum.isAllowNewTopic()); - sessionMap.put(ForumConstants.ATTR_ALLOW_RICH_EDITOR, allowRichEditor); - sessionMap.put(ForumConstants.ATTR_LIMITED_CHARS, new Integer(allowNumber)); - sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); - sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, forum.getTitle()); - sessionMap.put(ForumConstants.ATTR_FORUM_INSTRCUTION, forum.getInstructions()); - sessionMap.put(ForumConstants.ATTR_MINIMUM_REPLY, forum.getMinimumReply()); - sessionMap.put(ForumConstants.ATTR_MAXIMUM_REPLY, forum.getMaximumReply()); + // set some option flag to HttpSession + // if allowRichEditor = true then don't restrict the number of chars + // if isLimitedInput = false then don't restrict the number of chars + // Indicate don't restrict number of chars by allowNumber = 0 + Long forumId = forum.getUid(); + Boolean allowRichEditor = new Boolean(forum.isAllowRichEditor()); + int allowNumber = forum.isLimitedInput() || forum.isAllowRichEditor() ? forum.getLimitedChar() : 0; - // Should we show the reflection or not? We shouldn't show it when the screen is accessed - // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. - // Need to constantly past this value on, rather than hiding just the once, as the View Forum - // screen has a refresh button. - boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); - sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); + sessionMap.put(ForumConstants.FORUM_ID, forumId); + sessionMap.put(AttributeNames.ATTR_MODE, mode); + sessionMap.put(ForumConstants.ATTR_FINISHED_LOCK, new Boolean(lock)); + sessionMap.put(ForumConstants.ATTR_LOCK_WHEN_FINISHED, forum.getLockWhenFinished()); + sessionMap.put(ForumConstants.ATTR_USER_FINISHED, forumUser.isSessionFinished()); + sessionMap.put(ForumConstants.ATTR_ALLOW_EDIT, forum.isAllowEdit()); + sessionMap.put(ForumConstants.ATTR_ALLOW_UPLOAD, forum.isAllowUpload()); + sessionMap.put(ForumConstants.ATTR_ALLOW_NEW_TOPICS, forum.isAllowNewTopic()); + sessionMap.put(ForumConstants.ATTR_ALLOW_RICH_EDITOR, allowRichEditor); + sessionMap.put(ForumConstants.ATTR_LIMITED_CHARS, new Integer(allowNumber)); + sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); + sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, forum.getTitle()); + sessionMap.put(ForumConstants.ATTR_FORUM_INSTRCUTION, forum.getInstructions()); + sessionMap.put(ForumConstants.ATTR_MINIMUM_REPLY, forum.getMinimumReply()); + sessionMap.put(ForumConstants.ATTR_MAXIMUM_REPLY, forum.getMaximumReply()); - if (hideReflection) { - sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, false); - sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, ""); - sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, ""); - } - else { - sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, forum.isReflectOnActivity()); - sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, forum.getReflectInstructions()); + // Should we show the reflection or not? We shouldn't show it when the screen is accessed + // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. + // Need to constantly past this value on, rather than hiding just the once, as the View Forum + // screen has a refresh button. + boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); + sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); - NotebookEntry notebookEntry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, - ForumConstants.TOOL_SIGNATURE, forumUser.getUserId().intValue()); - sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, notebookEntry != null ? notebookEntry.getEntry() : ""); - } + if (hideReflection) { + sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, false); + sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, ""); + sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, ""); + } else { + sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, forum.isReflectOnActivity()); + sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, forum.getReflectInstructions()); - //add define later support - if (forum.isDefineLater()) { - return mapping.findForward("defineLater"); - } + NotebookEntry notebookEntry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ForumConstants.TOOL_SIGNATURE, forumUser.getUserId().intValue()); + sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, notebookEntry != null ? notebookEntry.getEntry() : ""); + } - //set contentInUse flag to true! - forum.setContentInUse(true); - forum.setDefineLater(false); - forumService.updateForum(forum); + // add define later support + if (forum.isDefineLater()) { + return mapping.findForward("defineLater"); + } - //add run offline support - if (forum.getRunOffline()) { - return mapping.findForward("runOffline"); - } + // set contentInUse flag to true! + forum.setContentInUse(true); + forum.setDefineLater(false); + forumService.updateForum(forum); - // get all root topic to display on init page - List rootTopics = forumService.getRootTopics(sessionId); - if (!forum.isAllowNewTopic()) { - // add the number post the learner has made for each topic. - updateNumOfPosts(rootTopics, forumUser); - } - request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); + // add run offline support + if (forum.getRunOffline()) { + return mapping.findForward("runOffline"); + } - if (forum.isNotifyLearnersOnMarkRelease()) { - forumService.getEventNotificationService().createEvent(ForumConstants.TOOL_SIGNATURE, - ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), - forumService.getLocalisedMessage("event.mark.release.subject", null), - forumService.getLocalisedMessage("event.mark.release.body", null)); + // get all root topic to display on init page + List rootTopics = forumService.getRootTopics(sessionId); + if (!forum.isAllowNewTopic()) { + // add the number post the learner has made for each topic. + updateNumOfPosts(rootTopics, forumUser); + } + request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); - forumService.getEventNotificationService().subscribe(ForumConstants.TOOL_SIGNATURE, - ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), - forumUser.getUserId().longValue(), IEventNotificationService.DELIVERY_METHOD_MAIL, - IEventNotificationService.PERIODICITY_SINGLE); - } - - // displaying new postings - for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { - MessageDTO messageDTO = (MessageDTO) iterator.next(); - int numOfNewPosts = forumService.getNewMessagesNum( - messageDTO.getMessage().getUid(), forumUser.getUid()); - if (numOfNewPosts == -1) // first time; show all postings as new, including root message - messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1); - else - messageDTO.setNewPostingsNum(numOfNewPosts); - - messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid())); - } + if (forum.isNotifyLearnersOnMarkRelease()) { + forumService.getEventNotificationService().createEvent(ForumConstants.TOOL_SIGNATURE, + ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), + forumService.getLocalisedMessage("event.mark.release.subject", null), + forumService.getLocalisedMessage("event.mark.release.body", null)); - return mapping.findForward("success"); + forumService.getEventNotificationService().subscribe(ForumConstants.TOOL_SIGNATURE, + ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), + forumUser.getUserId().longValue(), IEventNotificationService.DELIVERY_METHOD_MAIL, + IEventNotificationService.PERIODICITY_SINGLE); } - private void updateNumOfPosts(List rootTopics, ForumUser forumUser) { - for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { - MessageDTO messageDTO = (MessageDTO) iterator.next(); - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), messageDTO.getMessage().getUid()); - messageDTO.setNumOfPosts(numOfPosts); - } + // displaying new postings + for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { + MessageDTO messageDTO = (MessageDTO) iterator.next(); + int numOfNewPosts = forumService.getNewMessagesNum(messageDTO.getMessage().getUid(), forumUser.getUid()); + if (numOfNewPosts == -1) { + messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1); + } else { + messageDTO.setNewPostingsNum(numOfNewPosts); + } + + messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid())); } - /** - * Learner click "finish" button in forum page, this method will turn on - * session status flag for this learner. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + return mapping.findForward("success"); + } - ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + private void updateNumOfPosts(List rootTopics, ForumUser forumUser) { + for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { + MessageDTO messageDTO = (MessageDTO) iterator.next(); + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), messageDTO.getMessage().getUid()); + messageDTO.setNumOfPosts(numOfPosts); + } + } - forumService = getForumManager(); + /** + * Learner click "finish" button in forum page, this method will turn on session status flag for this learner. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { - if (!validateBeforeFinish(request, sessionMapID)) { - return mapping.getInputForward(); - } + ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - String nextActivityUrl; - try { - // get session from shared session. - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(user.getUserID().longValue()); + forumService = getForumManager(); - //finish current session for user - forumService.finishUserSession(getCurrentUser(request, sessionId)); - ToolSessionManager sessionMgrService = ForumServiceProxy.getToolSessionManager(getServlet().getServletContext()); - nextActivityUrl = sessionMgrService.leaveToolSession(sessionId, userID); - response.sendRedirect(nextActivityUrl); - } - catch (DataMissingException e) { - throw new ForumException(e); - } - catch (ToolException e) { - throw new ForumException(e); - } - catch (IOException e) { - throw new ForumException(e); - } - return null; + if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { + if (!validateBeforeFinish(request, sessionMapID)) { + return mapping.getInputForward(); + } - } - // get all root topic to display on init page - List rootTopics = forumService.getRootTopics(sessionId); - request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); + String nextActivityUrl; + try { + // get session from shared session. + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + Long userID = new Long(user.getUserID().longValue()); - return mapping.getInputForward(); + // finish current session for user + forumService.finishUserSession(getCurrentUser(request, sessionId)); + ToolSessionManager sessionMgrService = ForumServiceProxy.getToolSessionManager(getServlet() + .getServletContext()); + nextActivityUrl = sessionMgrService.leaveToolSession(sessionId, userID); + response.sendRedirect(nextActivityUrl); + } catch (DataMissingException e) { + throw new ForumException(e); + } catch (ToolException e) { + throw new ForumException(e); + } catch (IOException e) { + throw new ForumException(e); + } + return null; + } + // get all root topic to display on init page + List rootTopics = forumService.getRootTopics(sessionId); + request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); - /** - * Submit reflection form input database. - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - ReflectionForm refForm = (ReflectionForm) form; - Integer userId = refForm.getUserID(); + return mapping.getInputForward(); + } - String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + /** + * Submit reflection form input database. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + ReflectionForm refForm = (ReflectionForm) form; + Integer userId = refForm.getUserID(); - // check for existing notebook entry - NotebookEntry entry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, - ForumConstants.TOOL_SIGNATURE, userId); + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - if (entry == null) { - // create new entry - forumService.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, ForumConstants.TOOL_SIGNATURE, - userId, refForm.getEntryText()); - } - else { - // update existing entry - entry.setEntry(refForm.getEntryText()); - entry.setLastModified(new Date()); - forumService.updateEntry(entry); - } + // check for existing notebook entry + NotebookEntry entry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ForumConstants.TOOL_SIGNATURE, userId); - return finish(mapping, form, request, response); + if (entry == null) { + // create new entry + forumService.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ForumConstants.TOOL_SIGNATURE, userId, refForm.getEntryText()); + } else { + // update existing entry + entry.setEntry(refForm.getEntryText()); + entry.setLastModified(new Date()); + forumService.updateEntry(entry); } - /** - * Display empty reflection form. - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { + return finish(mapping, form, request, response); + } - //get session value - String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - if (!validateBeforeFinish(request, sessionMapID)) { - return mapping.getInputForward(); - } + /** + * Display empty reflection form. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - ReflectionForm refForm = (ReflectionForm) form; - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + // get session value + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + if (!validateBeforeFinish(request, sessionMapID)) { + return mapping.getInputForward(); + } - refForm.setUserID(user.getUserID()); - refForm.setSessionMapID(sessionMapID); + ReflectionForm refForm = (ReflectionForm) form; + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - // get the existing reflection entry - IForumService submitFilesService = getForumManager(); + refForm.setUserID(user.getUserID()); + refForm.setSessionMapID(sessionMapID); - SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID); - Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID); - NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, - ForumConstants.TOOL_SIGNATURE, user.getUserID()); + // get the existing reflection entry + IForumService submitFilesService = getForumManager(); - if (entry != null) { - refForm.setEntryText(entry.getEntry()); - } + SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID); + NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + ForumConstants.TOOL_SIGNATURE, user.getUserID()); - return mapping.findForward("success"); + if (entry != null) { + refForm.setEntryText(entry.getEntry()); } - // ========================================================================================== - // Topic level methods - // ========================================================================================== + return mapping.findForward("success"); + } - /** - * Display read-only page for a special topic. Topic will arrange by Tree - * structure. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { + // ========================================================================================== + // Topic level methods + // ========================================================================================== - forumService = getForumManager(); + /** + * Display read-only page for a special topic. Topic will arrange by Tree structure. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); + forumService = getForumManager(); - String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); + Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); - // get forum user and forum - ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); - Forum forum = forumUser.getSession().getForum(); + String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId); - // get root topic list - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + // get forum user and forum + ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); + Forum forum = forumUser.getSession().getForum(); - // check if we can still make posts in this topic - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), msgDtoList.get(0).getMessage().getUid()); - boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE - : Boolean.FALSE; - request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); - request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + // get root topic list + List msgDtoList = forumService.getTopicThread(rootTopicId); + updateMesssageFlag(msgDtoList); + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - //transfer SessionMapID as well - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); + // check if we can still make posts in this topic + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), msgDtoList.get(0).getMessage() + .getUid()); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); - // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed - // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. - // Need to constantly past this value on, rather than hiding just the once, as the View Forum - // screen has a refresh button. Need to pass it through the view topic screen and dependent screens - // as it has a link from the view topic screen back to View Forum screen. - boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); - sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); - - // Saving or updating user timestamp - saveUserTimestamp(rootTopicId, forumUser); - - return mapping.findForward("success"); + // transfer SessionMapID as well + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); + + // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed + // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. + // Need to constantly past this value on, rather than hiding just the once, as the View Forum + // screen has a refresh button. Need to pass it through the view topic screen and dependent screens + // as it has a link from the view topic screen back to View Forum screen. + boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); + sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); + + // Saving or updating user timestamp + saveUserTimestamp(rootTopicId, forumUser); + + return mapping.findForward("success"); + } + + /** + * Saving user timestamp + * + * @param toorTopicId + * @param forumUser + * @return + */ + private void saveUserTimestamp(Long rootTopicId, ForumUser forumUser) { + Date curDate = new Date(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + curDate = dateFormat.parse(dateFormat.format(new Date())); + } catch (ParseException pe) { + pe.printStackTrace(); } - - /** - * Saving user timestamp - * - * @param toorTopicId - * @param forumUser - * @return - */ - private void saveUserTimestamp(Long rootTopicId, ForumUser forumUser) - { - Date curDate = new Date(); - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - curDate = dateFormat.parse(dateFormat.format(new Date())); - } catch(ParseException pe) { - pe.printStackTrace(); - } - - Timestamp timestamp = forumService.getTimestamp(rootTopicId, forumUser.getUid()); - if (timestamp != null) - { - timestamp.setTimestamp(curDate); - forumService.saveTimestamp(timestamp); - } - else - { - timestamp = new Timestamp(); - timestamp.setMessage(forumService.getMessage(rootTopicId)); - timestamp.setTimestamp(curDate); - timestamp.setForumUser(forumUser); - forumService.saveTimestamp(timestamp); - } + + Timestamp timestamp = forumService.getTimestamp(rootTopicId, forumUser.getUid()); + if (timestamp != null) { + timestamp.setTimestamp(curDate); + forumService.saveTimestamp(timestamp); + } else { + timestamp = new Timestamp(); + timestamp.setMessage(forumService.getMessage(rootTopicId)); + timestamp.setTimestamp(curDate); + timestamp.setForumUser(forumUser); + forumService.saveTimestamp(timestamp); } + } - /** - * Display empty page for a new topic in forum - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward newTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - //transfer SessionMapID as well - ((MessageForm) form).setSessionMapID(WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); + /** + * Display empty page for a new topic in forum + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward newTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + // transfer SessionMapID as well + ((MessageForm) form).setSessionMapID(WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); - return mapping.findForward("success"); - } + return mapping.findForward("success"); + } - /** - * Create a new root topic. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - * @throws PersistenceException - */ - public ActionForward createTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException, PersistenceException { + /** + * Create a new root topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * @throws PersistenceException + */ + public ActionForward createTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException, PersistenceException { - MessageForm messageForm = (MessageForm) form; - SessionMap sessionMap = getSessionMap(request, messageForm); - Long forumId = (Long) sessionMap.get(ForumConstants.FORUM_ID); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + MessageForm messageForm = (MessageForm) form; + SessionMap sessionMap = getSessionMap(request, messageForm); + Long forumId = (Long) sessionMap.get(ForumConstants.FORUM_ID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - Message message = messageForm.getMessage(); - message.setIsAuthored(false); - message.setCreated(new Date()); - message.setUpdated(new Date()); - message.setLastReplyDate(new Date()); - ForumUser forumUser = getCurrentUser(request, sessionId); - message.setCreatedBy(forumUser); - message.setModifiedBy(forumUser); - setAttachment(messageForm, message); + Message message = messageForm.getMessage(); + message.setIsAuthored(false); + message.setCreated(new Date()); + message.setUpdated(new Date()); + message.setLastReplyDate(new Date()); + ForumUser forumUser = getCurrentUser(request, sessionId); + message.setCreatedBy(forumUser); + message.setModifiedBy(forumUser); + setAttachment(messageForm, message); - // save message into database - forumService = getForumManager(); - forumService.createRootTopic(forumId, sessionId, message); + // save message into database + forumService = getForumManager(); + forumService.createRootTopic(forumId, sessionId, message); - // echo back current root topic to forum init page - List rootTopics = forumService.getRootTopics(sessionId); - request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - - saveUserTimestamp(message.getUid(), forumUser); - - for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { - MessageDTO messageDTO = (MessageDTO) iterator.next(); - int numOfNewPosts = forumService.getNewMessagesNum( - messageDTO.getMessage().getUid(), forumUser.getUid()); - if (numOfNewPosts == -1) // first time; show all postings as new, including root message - messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1); - else - messageDTO.setNewPostingsNum(numOfNewPosts); - - messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid())); - } - - return mapping.findForward("success"); - } + // echo back current root topic to forum init page + List rootTopics = forumService.getRootTopics(sessionId); + request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - /** - * Display replay topic page. Message form subject will include parent - * topics same subject. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward newReplyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID); + saveUserTimestamp(message.getUid(), forumUser); - MessageForm msgForm = (MessageForm) form; - msgForm.setSessionMapID(sessionMapID); + for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) { + MessageDTO messageDTO = (MessageDTO) iterator.next(); + int numOfNewPosts = forumService.getNewMessagesNum(messageDTO.getMessage().getUid(), forumUser.getUid()); + if (numOfNewPosts == -1) { + messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1); + } else { + messageDTO.setNewPostingsNum(numOfNewPosts); + } - Long parentId = WebUtil.readLongParam(request, ForumConstants.ATTR_PARENT_TOPIC_ID); - // get parent topic, it can decide default subject of reply. - MessageDTO topic = getTopic(parentId); + messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid())); + } - if (topic != null && topic.getMessage() != null) { - String reTitle = topic.getMessage().getSubject(); + return mapping.findForward("success"); + } - MessageDTO originalMessage = MessageDTO.getMessageDTO(topic.getMessage()); + /** + * Display replay topic page. Message form subject will include parent topics same subject. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward newReplyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID); - request.setAttribute(ForumConstants.ATTR_ORIGINAL_MESSAGE, originalMessage); + MessageForm msgForm = (MessageForm) form; + msgForm.setSessionMapID(sessionMapID); - // echo back current topic subject to web page - if (reTitle != null && !reTitle.trim().startsWith("Re:")) { - msgForm.getMessage().setSubject("Re:" + reTitle); - } - else { - msgForm.getMessage().setSubject(reTitle); - } - } - SessionMap sessionMap = getSessionMap(request, msgForm); - sessionMap.put(ForumConstants.ATTR_PARENT_TOPIC_ID, parentId); + Long parentId = WebUtil.readLongParam(request, ForumConstants.ATTR_PARENT_TOPIC_ID); + // get parent topic, it can decide default subject of reply. + MessageDTO topic = getTopic(parentId); - // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed - // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. - // Need to constantly past this value on, rather than hiding just the once, as the View Forum - // screen has a refresh button. Need to pass it through the view topic screen and dependent screens - // as it has a link from the view topic screen back to View Forum screen. - boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); - sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); + if (topic != null && topic.getMessage() != null) { + String reTitle = topic.getMessage().getSubject(); - return mapping.findForward("success"); - } + MessageDTO originalMessage = MessageDTO.getMessageDTO(topic.getMessage()); - /** - * Create a replayed topic for a parent topic. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { + request.setAttribute(ForumConstants.ATTR_ORIGINAL_MESSAGE, originalMessage); - MessageForm messageForm = (MessageForm) form; - SessionMap sessionMap = getSessionMap(request, messageForm); - Long parentId = (Long) sessionMap.get(ForumConstants.ATTR_PARENT_TOPIC_ID); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + // echo back current topic subject to web page + if (reTitle != null && !reTitle.trim().startsWith("Re:")) { + msgForm.getMessage().setSubject("Re:" + reTitle); + } else { + msgForm.getMessage().setSubject(reTitle); + } + } + SessionMap sessionMap = getSessionMap(request, msgForm); + sessionMap.put(ForumConstants.ATTR_PARENT_TOPIC_ID, parentId); - Message message = messageForm.getMessage(); - message.setIsAuthored(false); - message.setCreated(new Date()); - message.setUpdated(new Date()); - message.setLastReplyDate(new Date()); - ForumUser forumUser = getCurrentUser(request, sessionId); - message.setCreatedBy(forumUser); - message.setModifiedBy(forumUser); - setAttachment(messageForm, message); + // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed + // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. + // Need to constantly past this value on, rather than hiding just the once, as the View Forum + // screen has a refresh button. Need to pass it through the view topic screen and dependent screens + // as it has a link from the view topic screen back to View Forum screen. + boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); + sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); - // save message into database - forumService = getForumManager(); - forumService.replyTopic(parentId, sessionId, message); + return mapping.findForward("success"); + } - // echo back this topic thread into page - Long rootTopicId = forumService.getRootTopicId(parentId); - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); + /** + * Create a replayed topic for a parent topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws InterruptedException + */ + private synchronized ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws InterruptedException { - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); + MessageForm messageForm = (MessageForm) form; + SessionMap sessionMap = getSessionMap(request, messageForm); + Long parentId = (Long) sessionMap.get(ForumConstants.ATTR_PARENT_TOPIC_ID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - //check whether allow more posts for this user - ForumToolSession session = forumService.getSessionBySessionId(sessionId); - Forum forum = session.getForum(); - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)).getMessage() - .getUid()); - boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE - : Boolean.FALSE; - request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); - request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + Message message = messageForm.getMessage(); + message.setIsAuthored(false); + message.setCreated(new Date()); + message.setUpdated(new Date()); + message.setLastReplyDate(new Date()); + ForumUser forumUser = getCurrentUser(request, sessionId); + message.setCreatedBy(forumUser); + message.setModifiedBy(forumUser); + setAttachment(messageForm, message); - sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE); - - // Saving or updating user timestamp - saveUserTimestamp(rootTopicId, forumUser); + // save message into database + forumService = getForumManager(); - return mapping.findForward("success"); - } + forumService.replyTopic(parentId, sessionId, message); - /** - * Display a editable form for a special topic in order to update it. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws PersistenceException - */ - public ActionForward editTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws PersistenceException { - Long topicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); + // echo back this topic thread into page + Long rootTopicId = forumService.getRootTopicId(parentId); + List msgDtoList = forumService.getTopicThread(rootTopicId); + updateMesssageFlag(msgDtoList); - MessageDTO topic = getTopic(topicId); + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - // echo current topic content to web page - MessageForm msgForm = (MessageForm) form; - if (topic != null) { - msgForm.setMessage(topic.getMessage()); - request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic); - } + // check whether allow more posts for this user + ForumToolSession session = forumService.getSessionBySessionId(sessionId); + Forum forum = session.getForum(); + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)) + .getMessage().getUid()); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); - //cache this topicID, using in Update topic - SessionMap sessionMap = getSessionMap(request, msgForm); - sessionMap.put(ForumConstants.ATTR_TOPIC_ID, topicId); + sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE); - // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed - // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. - // Need to constantly past this value on, rather than hiding just the once, as the View Forum - // screen has a refresh button. Need to pass it through the view topic screen and dependent screens - // as it has a link from the view topic screen back to View Forum screen. - boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); - sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); + // Saving or updating user timestamp + saveUserTimestamp(rootTopicId, forumUser); - return mapping.findForward("success"); - } + return mapping.findForward("success"); + } - /** - * Delete attachment from topic. This method only reset attachment information in memory. The finally update - * will happen in updateTopic method. So topic can keep this attachment if user choose "Cancel" edit - * topic. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward deleteAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { + /** + * Display a editable form for a special topic in order to update it. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws PersistenceException + */ + public ActionForward editTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws PersistenceException { + Long topicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID); - //only reset not attachment flag. - MessageDTO dto = new MessageDTO(); - dto.setHasAttachment(false); - request.setAttribute(ForumConstants.AUTHORING_TOPIC, dto); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute( - WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); - request.setAttribute(ForumConstants.ATTR_ALLOW_UPLOAD, sessionMap.get(ForumConstants.ATTR_ALLOW_UPLOAD)); + MessageDTO topic = getTopic(topicId); - return mapping.findForward("success"); + // echo current topic content to web page + MessageForm msgForm = (MessageForm) form; + if (topic != null) { + msgForm.setMessage(topic.getMessage()); + request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic); } - /** - * Update a topic. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws PersistenceException - */ - public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws PersistenceException { + // cache this topicID, using in Update topic + SessionMap sessionMap = getSessionMap(request, msgForm); + sessionMap.put(ForumConstants.ATTR_TOPIC_ID, topicId); - forumService = getForumManager(); + // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed + // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen. + // Need to constantly past this value on, rather than hiding just the once, as the View Forum + // screen has a refresh button. Need to pass it through the view topic screen and dependent screens + // as it has a link from the view topic screen back to View Forum screen. + boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false); + sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection); - MessageForm messageForm = (MessageForm) form; - SessionMap sessionMap = getSessionMap(request, messageForm); - Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID); - Message message = messageForm.getMessage(); + return mapping.findForward("success"); + } - boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE)); - String oldMessageString = null; + /** + * Delete attachment from topic. This method only reset attachment information in memory. The finally update will + * happen in updateTopic method. So topic can keep this attachment if user choose "Cancel" edit + * topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward deleteAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - // get PO from database and sync with Form - Message messagePO = forumService.getMessage(topicId); - if (makeAuditEntry) { - oldMessageString = messagePO.toString(); - } - messagePO.setSubject(message.getSubject()); - messagePO.setBody(message.getBody()); - messagePO.setUpdated(new Date()); - messagePO.setModifiedBy(getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID))); - setAttachment(messageForm, messagePO); + // only reset not attachment flag. + MessageDTO dto = new MessageDTO(); + dto.setHasAttachment(false); + request.setAttribute(ForumConstants.AUTHORING_TOPIC, dto); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute( + WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); + request.setAttribute(ForumConstants.ATTR_ALLOW_UPLOAD, sessionMap.get(ForumConstants.ATTR_ALLOW_UPLOAD)); - if (makeAuditEntry) { - Long userId = 0L; - String loginName = "Default"; - if (message.getCreatedBy() != null) { - userId = message.getCreatedBy().getUserId(); - loginName = message.getCreatedBy().getLoginName(); - } - forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName, oldMessageString, - messagePO.toString()); - } + return mapping.findForward("success"); + } - // save message into database - // if we are in monitoring then we are probably editing some else's entry so log the change. - forumService.updateTopic(messagePO); + /** + * Update a topic. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws PersistenceException + */ + public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws PersistenceException { - // echo back this topic thread into page - Long rootTopicId = forumService.getRootTopicId(topicId); - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); + forumService = getForumManager(); - // check if we can still make posts in this topic - ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); - Forum forum = forumUser.getSession().getForum(); - int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)).getMessage() - .getUid()); - boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE - : Boolean.FALSE; - request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); - request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); + MessageForm messageForm = (MessageForm) form; + SessionMap sessionMap = getSessionMap(request, messageForm); + Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID); + Message message = messageForm.getMessage(); - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - - // Saving or updating user timestamp - saveUserTimestamp(rootTopicId, forumUser); - - return mapping.findForward("success"); + boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE)); + String oldMessageString = null; + + // get PO from database and sync with Form + Message messagePO = forumService.getMessage(topicId); + if (makeAuditEntry) { + oldMessageString = messagePO.toString(); } + messagePO.setSubject(message.getSubject()); + messagePO.setBody(message.getBody()); + messagePO.setUpdated(new Date()); + messagePO.setModifiedBy(getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID))); + setAttachment(messageForm, messagePO); - /** - * Sets the visibility of a message by updating the hide flag for a message - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward updateMessageHideFlag(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { + if (makeAuditEntry) { + Long userId = 0L; + String loginName = "Default"; + if (message.getCreatedBy() != null) { + userId = message.getCreatedBy().getUserId(); + loginName = message.getCreatedBy().getLoginName(); + } + forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName, + oldMessageString, messagePO.toString()); + } - Long msgId = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID)); - Boolean hideFlag = new Boolean(WebUtil.readBooleanParam(request, "hideFlag")); - forumService = getForumManager(); + // save message into database + // if we are in monitoring then we are probably editing some else's entry so log the change. + forumService.updateTopic(messagePO); - // TODO Skipping permissions for now, currently having issues with default learning designs not having an create_by field - // Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - // check if the user has permission to hide posts. - // ForumToolSession toolSession = forumService - // .getSessionBySessionId(sessionId); - // - // Forum forum = toolSession.getForum(); - // ForumUser currentUser = getCurrentUser(request,sessionId); - // ForumUser forumCreatedBy = forum.getCreatedBy(); + // echo back this topic thread into page + Long rootTopicId = forumService.getRootTopicId(topicId); + List msgDtoList = forumService.getTopicThread(rootTopicId); + updateMesssageFlag(msgDtoList); - // we should be looking at whether a user is a teacher and more specifically staff - // if (currentUser.getUserId().equals(forumCreatedBy.getUserId())) { - forumService.updateMessageHideFlag(msgId, hideFlag.booleanValue()); - // } else { - // log.info(currentUser + "does not have permission to hide/show postings in forum: " + forum.getUid()); - // log.info("Forum created by :" + forumCreatedBy.getUid() + ", Current User is: " + currentUser.getUid()); - // } + // check if we can still make posts in this topic + ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)); + Forum forum = forumUser.getSession().getForum(); + int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)) + .getMessage().getUid()); + boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() + && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE; + request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts); + request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts); - // echo back this topic thread into page - Long rootTopicId = forumService.getRootTopicId(msgId); - List msgDtoList = forumService.getTopicThread(rootTopicId); - updateMesssageFlag(msgDtoList); - request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, WebUtil - .readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID)); - - return mapping.findForward("success"); - } + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID()); - // ========================================================================================== - // Utility methods - // ========================================================================================== - /** - * Validation method to check whether user posts meet minimum number. - */ - private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) { - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + // Saving or updating user timestamp + saveUserTimestamp(rootTopicId, forumUser); - ForumToolSession session = forumService.getSessionBySessionId(sessionId); - Forum forum = session.getForum(); - // get session from shared session. - HttpSession ss = SessionManager.getSession(); - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - Long userID = new Long(user.getUserID().longValue()); - if (!forum.getRunOffline() && !forum.isAllowNewTopic()) { + return mapping.findForward("success"); + } - List list = forumService.getRootTopics(sessionId); - for (MessageDTO msgDto : list) { - Long topicId = msgDto.getMessage().getUid(); - int numOfPostsInTopic = forumService.getNumOfPostsByTopic(userID, topicId); - if (numOfPostsInTopic < forum.getMinimumReply()) { - //create error - ActionMessages errors = new ActionMessages(); - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.less.mini.post", forum.getMinimumReply())); - saveErrors(request, errors); + /** + * Sets the visibility of a message by updating the hide flag for a message + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public ActionForward updateMessageHideFlag(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - // get all root topic to display on init page - List rootTopics = forumService.getRootTopics(sessionId); - request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); - request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return false; - } + Long msgId = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID)); + Boolean hideFlag = new Boolean(WebUtil.readBooleanParam(request, "hideFlag")); + forumService = getForumManager(); - } - } - return true; - } + // TODO Skipping permissions for now, currently having issues with default learning designs not having an + // create_by field + // Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + // check if the user has permission to hide posts. + // ForumToolSession toolSession = forumService + // .getSessionBySessionId(sessionId); + // + // Forum forum = toolSession.getForum(); + // ForumUser currentUser = getCurrentUser(request,sessionId); + // ForumUser forumCreatedBy = forum.getCreatedBy(); - /** - * This method will set flag in message DTO: - *
  • If this topic is created by current login user, then set Author mark - * true.
  • - * - * @param msgDtoList - */ - private void updateMesssageFlag(List msgDtoList) { - // set current user to web page, so that can display "edit" button - // correct. Only author alow to edit. - HttpSession ss = SessionManager.getSession(); - // get back login user DTO - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + // we should be looking at whether a user is a teacher and more specifically staff + // if (currentUser.getUserId().equals(forumCreatedBy.getUserId())) { + forumService.updateMessageHideFlag(msgId, hideFlag.booleanValue()); + // } else { + // log.info(currentUser + "does not have permission to hide/show postings in forum: " + forum.getUid()); + // log.info("Forum created by :" + forumCreatedBy.getUid() + ", Current User is: " + currentUser.getUid()); + // } - Long currUserId = new Long(user.getUserID().intValue()); - Iterator iter = msgDtoList.iterator(); - while (iter.hasNext()) { - MessageDTO dto = (MessageDTO) iter.next(); - if (dto.getMessage().getCreatedBy() != null && currUserId.equals(dto.getMessage().getCreatedBy().getUserId())) { - dto.setAuthor(true); - } - else { - dto.setAuthor(false); - } + // echo back this topic thread into page + Long rootTopicId = forumService.getRootTopicId(msgId); + List msgDtoList = forumService.getTopicThread(rootTopicId); + updateMesssageFlag(msgDtoList); + request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, WebUtil.readStrParam(request, + ForumConstants.ATTR_SESSION_MAP_ID)); + + return mapping.findForward("success"); + } + + // ========================================================================================== + // Utility methods + // ========================================================================================== + /** + * Validation method to check whether user posts meet minimum number. + */ + private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) { + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + ForumToolSession session = forumService.getSessionBySessionId(sessionId); + Forum forum = session.getForum(); + // get session from shared session. + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + Long userID = new Long(user.getUserID().longValue()); + if (!forum.getRunOffline() && !forum.isAllowNewTopic()) { + + List list = forumService.getRootTopics(sessionId); + for (MessageDTO msgDto : list) { + Long topicId = msgDto.getMessage().getUid(); + int numOfPostsInTopic = forumService.getNumOfPostsByTopic(userID, topicId); + if (numOfPostsInTopic < forum.getMinimumReply()) { + // create error + ActionMessages errors = new ActionMessages(); + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.less.mini.post", forum + .getMinimumReply())); + saveErrors(request, errors); + + // get all root topic to display on init page + List rootTopics = forumService.getRootTopics(sessionId); + request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics); + request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return false; } - } - /** - * @param topicId - * @return - */ - private MessageDTO getTopic(Long topicId) { - // get Topic content according to TopicID - forumService = getForumManager(); - MessageDTO topic = MessageDTO.getMessageDTO(forumService.getMessage(topicId)); - return topic; + } } + return true; + } - /** - * Get login user information from system level session. Check it whether it - * exists in database or not, and save it if it does not exists. Return an - * instance of PO of ForumUser. - * - * @param request - * @param sessionId - * @return Current user instance - */ - private ForumUser getCurrentUser(HttpServletRequest request, Long sessionId) { - // get login user (author) - HttpSession ss = SessionManager.getSession(); - // get back login user DTO - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); - ForumUser forumUser = forumService.getUserByUserAndSession(new Long(user.getUserID().intValue()), sessionId); - if (forumUser == null) { - // if user not exist, create new one in database - ForumToolSession session = forumService.getSessionBySessionId(sessionId); - forumUser = new ForumUser(user, session); - forumService.createUser(forumUser); - } - return forumUser; + /** + * This method will set flag in message DTO: + *
  • If this topic is created by current login user, then set Author mark true.
  • + * + * @param msgDtoList + */ + private void updateMesssageFlag(List msgDtoList) { + // set current user to web page, so that can display "edit" button + // correct. Only author alow to edit. + HttpSession ss = SessionManager.getSession(); + // get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + + Long currUserId = new Long(user.getUserID().intValue()); + Iterator iter = msgDtoList.iterator(); + while (iter.hasNext()) { + MessageDTO dto = (MessageDTO) iter.next(); + if (dto.getMessage().getCreatedBy() != null + && currUserId.equals(dto.getMessage().getCreatedBy().getUserId())) { + dto.setAuthor(true); + } else { + dto.setAuthor(false); + } } + } - /** - * Get Forum Service. - * - * @return - */ - private IForumService getForumManager() { - if (forumService == null) { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() - .getServletContext()); - forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE); - } - return forumService; + /** + * @param topicId + * @return + */ + private MessageDTO getTopic(Long topicId) { + // get Topic content according to TopicID + forumService = getForumManager(); + MessageDTO topic = MessageDTO.getMessageDTO(forumService.getMessage(topicId)); + return topic; + } + + /** + * Get login user information from system level session. Check it whether it exists in database or not, and save it + * if it does not exists. Return an instance of PO of ForumUser. + * + * @param request + * @param sessionId + * @return Current user instance + */ + private ForumUser getCurrentUser(HttpServletRequest request, Long sessionId) { + // get login user (author) + HttpSession ss = SessionManager.getSession(); + // get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + ForumUser forumUser = forumService.getUserByUserAndSession(new Long(user.getUserID().intValue()), sessionId); + if (forumUser == null) { + // if user not exist, create new one in database + ForumToolSession session = forumService.getSessionBySessionId(sessionId); + forumUser = new ForumUser(user, session); + forumService.createUser(forumUser); } + return forumUser; + } - /** - * @param messageForm - * @param message - */ - private void setAttachment(MessageForm messageForm, Message message) { - if (messageForm.getAttachmentFile() != null && !StringUtils.isBlank(messageForm.getAttachmentFile().getFileName())) { - forumService = getForumManager(); - Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); - Set attSet = message.getAttachments(); - if (attSet == null) { - attSet = new HashSet(); - } - // only allow one attachment, so replace whatever - attSet.clear(); - attSet.add(att); - message.setAttachments(attSet); - } - else if (!messageForm.isHasAttachment()) { - //user already called deleteAttachment in AJAX call - if (message.getAttachments() != null) { - Set atts = message.getAttachments(); - atts.clear(); - message.setAttachments(atts); - } - else { - message.setAttachments(null); - } - } + /** + * Get Forum Service. + * + * @return + */ + private IForumService getForumManager() { + if (forumService == null) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE); } + return forumService; + } - private SessionMap getSessionMap(HttpServletRequest request, MessageForm messageForm) { - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(messageForm.getSessionMapID()); - return sessionMap; + /** + * @param messageForm + * @param message + */ + private void setAttachment(MessageForm messageForm, Message message) { + if (messageForm.getAttachmentFile() != null + && !StringUtils.isBlank(messageForm.getAttachmentFile().getFileName())) { + forumService = getForumManager(); + Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile()); + Set attSet = message.getAttachments(); + if (attSet == null) { + attSet = new HashSet(); + } + // only allow one attachment, so replace whatever + attSet.clear(); + attSet.add(att); + message.setAttachments(attSet); + } else if (!messageForm.isHasAttachment()) { + // user already called deleteAttachment in AJAX call + if (message.getAttachments() != null) { + Set atts = message.getAttachments(); + atts.clear(); + message.setAttachments(atts); + } else { + message.setAttachments(null); + } } + } + private SessionMap getSessionMap(HttpServletRequest request, MessageForm messageForm) { + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(messageForm.getSessionMapID()); + return sessionMap; + } + } Fisheye: Tag 1.3.4.1 refers to a dead (removed) revision in file `lams_tool_forum/web/WEB-INF/struts/validator-rules.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_gmap/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/.classpath,v diff -u -r1.5 -r1.5.6.1 --- lams_tool_gmap/.classpath 30 Oct 2008 03:48:29 -0000 1.5 +++ lams_tool_gmap/.classpath 30 Jun 2009 03:05:45 -0000 1.5.6.1 @@ -4,13 +4,16 @@ - - - + + + + + + - + Index: lams_tool_gmap/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_gmap/conf/xdoclet/web-settings.xml,v diff -u -r1.3 -r1.3.2.1 --- lams_tool_gmap/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:38 -0000 1.3 +++ lams_tool_gmap/conf/xdoclet/web-settings.xml 30 Jun 2009 03:05:48 -0000 1.3.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.gmap.ApplicationResources
    + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/gmap/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_images/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/.classpath,v diff -u -r1.2 -r1.2.4.1 --- lams_tool_images/.classpath 21 Dec 2008 23:33:14 -0000 1.2 +++ lams_tool_images/.classpath 30 Jun 2009 03:05:57 -0000 1.2.4.1 @@ -3,20 +3,19 @@ - - - - - - - - + + + + + + + Index: lams_tool_images/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/WEB-INF/web.xml,v diff -u -r1.4 -r1.4.2.1 --- lams_tool_images/web/WEB-INF/web.xml 26 Mar 2009 10:00:38 -0000 1.4 +++ lams_tool_images/web/WEB-INF/web.xml 30 Jun 2009 03:06:04 -0000 1.4.2.1 @@ -9,13 +9,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.imageGallery.ApplicationResources + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/imageGallery/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey @@ -213,10 +218,10 @@ - - Secure Content + + Secure Content /* - + LEARNER TEACHER @@ -229,61 +234,61 @@ - - Authoring Update + + Authoring Update /authoring/* - + AUTHOR AUTHOR ADMIN SYSADMIN - - Staff Content + + Staff Content /monitoring.do - + MONITOR TEACHER - - Staff Content + + Staff Content /definelater.do - + MONITOR TEACHER - - Adminstrator Content + + Adminstrator Content /admin.do - + ADMIN - - LAMS System Adminstrator Content + + LAMS System Adminstrator Content /sysadmin.do - + SYSADMIN - - Download Files + + Download Files /download/ - + LEARNER AUTHOR Index: lams_tool_lamc/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/.classpath,v diff -u -r1.5 -r1.5.6.1 --- lams_tool_lamc/.classpath 30 Oct 2008 03:48:31 -0000 1.5 +++ lams_tool_lamc/.classpath 30 Jun 2009 03:06:11 -0000 1.5.6.1 @@ -5,12 +5,15 @@ - - - + + + + + + - + Index: lams_tool_lamc/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/WEB-INF/web.xml,v diff -u -r1.28 -r1.28.2.1 --- lams_tool_lamc/web/WEB-INF/web.xml 26 Mar 2009 10:00:38 -0000 1.28 +++ lams_tool_lamc/web/WEB-INF/web.xml 30 Jun 2009 03:06:22 -0000 1.28.2.1 @@ -6,13 +6,17 @@ org.lamsfoundation.lams.tool.mc.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/mc/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_laqa/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/.classpath,v diff -u -r1.10 -r1.10.6.1 --- lams_tool_laqa/.classpath 30 Oct 2008 03:48:32 -0000 1.10 +++ lams_tool_laqa/.classpath 30 Jun 2009 03:06:28 -0000 1.10.6.1 @@ -5,12 +5,15 @@ - - - + + + + + + - + Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java,v diff -u -r1.22 -r1.22.4.1 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java 19 Feb 2009 23:59:13 -0000 1.22 +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java 30 Jun 2009 03:06:32 -0000 1.22.4.1 @@ -38,8 +38,8 @@ /** * @author Ozgur Demirtas * - * TODO To change the template for this generated type comment go to Window - - * Preferences - Java - Code Style - Code Templates + * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code + * Templates */ public class QaQueUsrDAO extends HibernateDaoSupport implements IQaQueUsrDAO { @@ -51,14 +51,15 @@ private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQueContent qcon where " + "quser.qaSession=qses and " + "qses.qaContent=qcon and " + "qcon.uid=:uid"; - // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and qses.qa_content_id=5378; + // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and + // qses.qa_content_id=5378; public QaQueUsr getQaUserByUID(Long uid) { return (QaQueUsr) this.getHibernateTemplate().get(QaQueUsr.class, uid); } public int countSessionUser(QaSession qaSession) { - return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, "qaSession", qaSession)).size(); + return getHibernateTemplate().findByNamedParam(QaQueUsrDAO.COUNT_SESSION_USER, "qaSession", qaSession).size(); } public QaQueUsr getQaQueUsrById(long qaQueUsrId) { @@ -90,7 +91,7 @@ public List getUserBySessionOnly(final QaSession qaSession) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_FOR_SESSION).setLong("qaSessionId", + List list = getSession().createQuery(QaQueUsrDAO.LOAD_USER_FOR_SESSION).setLong("qaSessionId", qaSession.getUid().longValue()).list(); return list; } @@ -118,13 +119,14 @@ int returnInt = 0; if (qa != null && qa.getUid() != null) { - List result = getSession().createQuery(GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()).list(); - Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0); - returnInt = resultInt.intValue(); + List result = getSession().createQuery(QaQueUsrDAO.GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()) + .list(); + Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0); + returnInt = resultLong.intValue(); } else { - logger.error("Attempt to count users from null content"); + QaQueUsrDAO.logger.error("Attempt to count users from null content"); } - return returnInt; + return returnInt; } } \ No newline at end of file Index: lams_tool_laqa/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_laqa/web/WEB-INF/web.xml,v diff -u -r1.30 -r1.30.2.1 --- lams_tool_laqa/web/WEB-INF/web.xml 26 Mar 2009 10:00:38 -0000 1.30 +++ lams_tool_laqa/web/WEB-INF/web.xml 30 Jun 2009 03:06:36 -0000 1.30.2.1 @@ -6,14 +6,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.qa.ApplicationResources - + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/qa/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_larsrc/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/.classpath,v diff -u -r1.6 -r1.6.6.1 --- lams_tool_larsrc/.classpath 30 Oct 2008 03:48:31 -0000 1.6 +++ lams_tool_larsrc/.classpath 30 Jun 2009 03:06:39 -0000 1.6.6.1 @@ -9,19 +9,21 @@ - - - - - + + + + + + + Index: lams_tool_larsrc/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/web/WEB-INF/web.xml,v diff -u -r1.20 -r1.20.2.1 --- lams_tool_larsrc/web/WEB-INF/web.xml 26 Mar 2009 10:00:38 -0000 1.20 +++ lams_tool_larsrc/web/WEB-INF/web.xml 30 Jun 2009 03:06:44 -0000 1.20.2.1 @@ -9,13 +9,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.rsrc.ApplicationResources + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/rsrc/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_mindmap/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_mindmap/.classpath,v diff -u -r1.1 -r1.1.2.1 --- lams_tool_mindmap/.classpath 3 Apr 2009 00:00:33 -0000 1.1 +++ lams_tool_mindmap/.classpath 30 Jun 2009 03:06:48 -0000 1.1.2.1 @@ -1,23 +1,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + Index: lams_tool_mindmap/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_mindmap/conf/xdoclet/web-settings.xml,v diff -u -r1.1 -r1.1.2.1 --- lams_tool_mindmap/conf/xdoclet/web-settings.xml 3 Apr 2009 00:00:32 -0000 1.1 +++ lams_tool_mindmap/conf/xdoclet/web-settings.xml 30 Jun 2009 03:06:50 -0000 1.1.2.1 @@ -5,6 +5,10 @@ org.lamsfoundation.lams.tool.mindmap.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation @@ -14,7 +18,7 @@ locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml Index: lams_tool_nb/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/.classpath,v diff -u -r1.7 -r1.7.6.1 --- lams_tool_nb/.classpath 30 Oct 2008 03:48:29 -0000 1.7 +++ lams_tool_nb/.classpath 30 Jun 2009 03:06:56 -0000 1.7.6.1 @@ -6,12 +6,15 @@ - - - + + + + + + - + Index: lams_tool_nb/conf/xdoclet/servlets.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/servlets.xml,v diff -u -r1.7 -r1.7.8.1 --- lams_tool_nb/conf/xdoclet/servlets.xml 30 Jun 2006 07:04:06 -0000 1.7 +++ lams_tool_nb/conf/xdoclet/servlets.xml 30 Jun 2009 03:06:58 -0000 1.7.8.1 @@ -22,9 +22,7 @@ - download - Instructions Download - Instructions Download + download org.lamsfoundation.lams.contentrepository.client.ToolDownload toolContentHandlerBeanName @@ -35,8 +33,6 @@ exportPortfolio - Export Portfolio - Export Portfolio org.lamsfoundation.lams.tool.noticeboard.web.NbExportServlet Index: lams_tool_nb/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/conf/xdoclet/web-settings.xml,v diff -u -r1.8 -r1.8.2.1 --- lams_tool_nb/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:38 -0000 1.8 +++ lams_tool_nb/conf/xdoclet/web-settings.xml 30 Jun 2009 03:06:58 -0000 1.8.2.1 @@ -2,13 +2,18 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.noticeboard.ApplicationResources + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/noticeboard/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_notebook/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/.classpath,v diff -u -r1.3 -r1.3.6.1 --- lams_tool_notebook/.classpath 30 Oct 2008 03:48:31 -0000 1.3 +++ lams_tool_notebook/.classpath 30 Jun 2009 03:07:04 -0000 1.3.6.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_notebook/conf/xdoclet/servlets.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/conf/xdoclet/servlets.xml,v diff -u -r1.2 -r1.2.4.1 --- lams_tool_notebook/conf/xdoclet/servlets.xml 6 Feb 2009 02:23:09 -0000 1.2 +++ lams_tool_notebook/conf/xdoclet/servlets.xml 30 Jun 2009 03:07:08 -0000 1.2.4.1 @@ -39,7 +39,6 @@ Attachment Download - Attachment Download download org.lamsfoundation.lams.contentrepository.client.ToolDownload Index: lams_tool_notebook/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/conf/xdoclet/web-settings.xml,v diff -u -r1.3 -r1.3.2.1 --- lams_tool_notebook/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:39 -0000 1.3 +++ lams_tool_notebook/conf/xdoclet/web-settings.xml 30 Jun 2009 03:07:08 -0000 1.3.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.notebook.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/notebook/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_pixlr/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_pixlr/.classpath,v diff -u -r1.1 -r1.1.4.1 --- lams_tool_pixlr/.classpath 7 Jan 2009 22:37:48 -0000 1.1 +++ lams_tool_pixlr/.classpath 30 Jun 2009 03:07:15 -0000 1.1.4.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_pixlr/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_pixlr/conf/xdoclet/web-settings.xml,v diff -u -r1.2 -r1.2.2.1 --- lams_tool_pixlr/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:39 -0000 1.2 +++ lams_tool_pixlr/conf/xdoclet/web-settings.xml 30 Jun 2009 03:07:17 -0000 1.2.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.pixlr.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/pixlr/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_sbmt/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/.classpath,v diff -u -r1.17.6.1 -r1.17.6.2 --- lams_tool_sbmt/.classpath 23 Apr 2009 00:26:40 -0000 1.17.6.1 +++ lams_tool_sbmt/.classpath 30 Jun 2009 03:07:22 -0000 1.17.6.2 @@ -4,13 +4,16 @@ - - - + + + + + + - + Index: lams_tool_sbmt/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/conf/xdoclet/web-settings.xml,v diff -u -r1.9 -r1.9.2.1 --- lams_tool_sbmt/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:39 -0000 1.9 +++ lams_tool_sbmt/conf/xdoclet/web-settings.xml 30 Jun 2009 03:07:24 -0000 1.9.2.1 @@ -1,13 +1,17 @@ LAMS Learning Activity Management System + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/sbmt/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_scribe/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scribe/.classpath,v diff -u -r1.3 -r1.3.6.1 --- lams_tool_scribe/.classpath 30 Oct 2008 03:48:31 -0000 1.3 +++ lams_tool_scribe/.classpath 30 Jun 2009 03:07:30 -0000 1.3.6.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_scribe/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scribe/conf/xdoclet/web-settings.xml,v diff -u -r1.3 -r1.3.2.1 --- lams_tool_scribe/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:39 -0000 1.3 +++ lams_tool_scribe/conf/xdoclet/web-settings.xml 30 Jun 2009 03:07:33 -0000 1.3.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.scribe.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/scribe/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_spreadsheet/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_spreadsheet/.classpath,v diff -u -r1.4 -r1.4.6.1 --- lams_tool_spreadsheet/.classpath 10 Nov 2008 11:13:51 -0000 1.4 +++ lams_tool_spreadsheet/.classpath 30 Jun 2009 03:07:39 -0000 1.4.6.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_spreadsheet/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_spreadsheet/web/WEB-INF/web.xml,v diff -u -r1.5 -r1.5.2.1 --- lams_tool_spreadsheet/web/WEB-INF/web.xml 26 Mar 2009 10:00:40 -0000 1.5 +++ lams_tool_spreadsheet/web/WEB-INF/web.xml 30 Jun 2009 03:07:43 -0000 1.5.2.1 @@ -9,13 +9,17 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.spreadsheet.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/spreadsheet/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_survey/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/.classpath,v diff -u -r1.4 -r1.4.6.1 --- lams_tool_survey/.classpath 30 Oct 2008 03:48:30 -0000 1.4 +++ lams_tool_survey/.classpath 30 Jun 2009 03:07:48 -0000 1.4.6.1 @@ -4,12 +4,15 @@ - - - + + + + + + - + Index: lams_tool_survey/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/web/WEB-INF/web.xml,v diff -u -r1.10 -r1.10.2.1 --- lams_tool_survey/web/WEB-INF/web.xml 26 Mar 2009 10:00:40 -0000 1.10 +++ lams_tool_survey/web/WEB-INF/web.xml 30 Jun 2009 03:07:51 -0000 1.10.2.1 @@ -9,13 +9,17 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.survey.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/survey/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_task/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/.classpath,v diff -u -r1.4 -r1.4.6.1 --- lams_tool_task/.classpath 30 Oct 2008 03:48:30 -0000 1.4 +++ lams_tool_task/.classpath 30 Jun 2009 03:07:54 -0000 1.4.6.1 @@ -4,9 +4,12 @@ - - - + + + + + + @@ -15,4 +18,4 @@ - + Index: lams_tool_task/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/WEB-INF/web.xml,v diff -u -r1.6 -r1.6.2.1 --- lams_tool_task/web/WEB-INF/web.xml 26 Mar 2009 10:00:40 -0000 1.6 +++ lams_tool_task/web/WEB-INF/web.xml 30 Jun 2009 03:07:57 -0000 1.6.2.1 @@ -9,13 +9,17 @@ javax.servlet.jsp.jstl.fmt.localizationContext org.lamsfoundation.lams.tool.taskList.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/taskList/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_videorecorder/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_videorecorder/.classpath,v diff -u -r1.2.2.2 -r1.2.2.3 --- lams_tool_videorecorder/.classpath 17 Apr 2009 08:21:38 -0000 1.2.2.2 +++ lams_tool_videorecorder/.classpath 30 Jun 2009 03:08:00 -0000 1.2.2.3 @@ -4,13 +4,16 @@ - - - + + + + + + - + Index: lams_tool_videorecorder/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_videorecorder/conf/xdoclet/web-settings.xml,v diff -u -r1.2.2.4 -r1.2.2.5 --- lams_tool_videorecorder/conf/xdoclet/web-settings.xml 7 May 2009 06:54:51 -0000 1.2.2.4 +++ lams_tool_videorecorder/conf/xdoclet/web-settings.xml 30 Jun 2009 03:08:02 -0000 1.2.2.5 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.videoRecorder.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/videoRecorder/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_vote/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/.classpath,v diff -u -r1.4 -r1.4.6.1 --- lams_tool_vote/.classpath 30 Oct 2008 03:48:30 -0000 1.4 +++ lams_tool_vote/.classpath 30 Jun 2009 03:08:07 -0000 1.4.6.1 @@ -5,12 +5,15 @@ - - - + + + + + + - + Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java,v diff -u -r1.32 -r1.32.4.1 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 18 Feb 2009 23:06:58 -0000 1.32 +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 30 Jun 2009 03:08:09 -0000 1.32.4.1 @@ -41,8 +41,7 @@ /** * @author Ozgur Demirtas repaired by lfoxton *

    - * Hibernate implementation for database access to VoteUsrAttemptDAO for - * the voting tool. + * Hibernate implementation for database access to VoteUsrAttemptDAO for the voting tool. *

    */ public class VoteUsrAttemptDAO extends HibernateDaoSupport implements IVoteUsrAttemptDAO { @@ -70,20 +69,19 @@ // lfoxton about below: // No! Very Bad programmer!!! Go to your room and think about what you did! - //private static final String LOAD_ALL_ENTRIES = "from voteUsrAttempt in class VoteUsrAttempt"; + // private static final String LOAD_ALL_ENTRIES = "from voteUsrAttempt in class VoteUsrAttempt"; private static final String LOAD_DISTINCT_USER_ENTRIES = "select distinct voteUsrAttempt.queUsrId from VoteUsrAttempt voteUsrAttempt"; private static final String COUNT_ATTEMPTS_BY_CONTENT_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where " + "att.voteQueUsr=user and user.voteSession=ses and " + "ses.voteContentId=:voteContentId"; - + private static final String LOAD_ENTRIES_BY_SESSION_ID = "select att from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where " + "att.voteQueUsr=user and user.voteSession=ses and ses.uid=:voteSessionUid"; - + private static final String COUNT_ENTRIES_BY_SESSION_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where " + "att.voteQueUsr=user and user.voteSession=ses and ses.uid=:voteSessionUid"; - public VoteUsrAttempt getVoteUserAttemptByUID(Long uid) { return (VoteUsrAttempt) this.getHibernateTemplate().get(VoteUsrAttempt.class, uid); } @@ -107,20 +105,21 @@ public List getAttemptsForUser(final Long queUsrId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", queUsrId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", + queUsrId.longValue()).list(); return list; } public int getUserEnteredVotesCountForContent(final Long voteContentUid) { - List result = getSession().createQuery(COUNT_ATTEMPTS_BY_CONTENT_ID).setLong("voteContentId", voteContentUid) - .list(); - Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0); - return resultInt.intValue(); + List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ATTEMPTS_BY_CONTENT_ID).setLong("voteContentId", + voteContentUid).list(); + Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0); + return resultLong.intValue(); } public Set getUserEntries() { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_ENTRIES).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRIES).list(); Set set = new HashSet(); @@ -129,32 +128,34 @@ Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { String entry = (String) listIterator.next(); - logger.debug("entry: " + entry); - if ((entry != null) && (entry.length() > 0)) + VoteUsrAttemptDAO.logger.debug("entry: " + entry); + if (entry != null && entry.length() > 0) { userEntries.add(entry); + } } } return userEntries; } public List getSessionUserEntries(final Long voteSessionUid) { - - return getSession().createQuery(LOAD_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", voteSessionUid).list(); + + return getSession().createQuery(VoteUsrAttemptDAO.LOAD_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", + voteSessionUid).list(); } public Set getSessionUserEntriesSet(final Long voteSessionUid) { - List list = (List)getSessionUserEntries(voteSessionUid); + List list = getSessionUserEntries(voteSessionUid); Set sessionUserEntries = new HashSet(); - for (VoteUsrAttempt att : list) - { + for (VoteUsrAttempt att : list) { sessionUserEntries.add(att); } return sessionUserEntries; } public int getUserRecordsEntryCount(final String userEntry) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", + userEntry).list(); if (list != null && list.size() > 0) { return list.size(); @@ -166,18 +167,19 @@ public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid, IVoteService voteService) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", + userEntry).list(); int entryCount = 0; if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { Long userId = (Long) listIterator.next(); - logger.debug("userId: " + userId); - logger.debug("voteService: " + voteService); + VoteUsrAttemptDAO.logger.debug("userId: " + userId); + VoteUsrAttemptDAO.logger.debug("voteService: " + voteService); VoteQueUsr voteQueUsr = voteService.getVoteUserByUID(userId); - logger.debug("voteQueUsr: " + voteQueUsr); + VoteUsrAttemptDAO.logger.debug("voteQueUsr: " + voteQueUsr); if (voteQueUsr.getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { ++entryCount; @@ -189,7 +191,8 @@ public void removeAttemptsForUser(final Long queUsrId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", queUsrId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", + queUsrId.longValue()).list(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); @@ -223,8 +226,8 @@ public int getAttemptsForQuestionContent(final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId", - voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong( + "voteQueContentId", voteQueContentId.longValue()).list(); if (list != null && list.size() > 0) { return list.size(); @@ -235,8 +238,8 @@ public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId", - voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong( + "voteQueContentId", voteQueContentId.longValue()).list(); List userEntries = new ArrayList(); if (list != null && list.size() > 0) { @@ -255,8 +258,8 @@ public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId", - voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong( + "voteQueContentId", voteQueContentId.longValue()).list(); List userEntries = new ArrayList(); if (list != null && list.size() > 0) { @@ -274,19 +277,21 @@ public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry", + userEntry).list(); List sessionUserEntries = new ArrayList(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - logger.debug("attempt: " + attempt); + VoteUsrAttemptDAO.logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { boolean isVoteVisible = attempt.isVisible(); - logger.debug("isVoteVisible: " + isVoteVisible); - if (isVoteVisible == false) + VoteUsrAttemptDAO.logger.debug("isVoteVisible: " + isVoteVisible); + if (isVoteVisible == false) { return false; + } } } } @@ -296,8 +301,8 @@ public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId", - voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong( + "voteQueContentId", voteQueContentId.longValue()).list(); List userEntries = new ArrayList(); if (list != null && list.size() > 0) { @@ -317,23 +322,24 @@ public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId", - queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong( + "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); return list; } public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION).setLong( - "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION) + .setLong("queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()) + .list(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - logger.debug("attempt: " + attempt); + VoteUsrAttemptDAO.logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { return attempt; } @@ -343,61 +349,63 @@ } public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) { - logger.debug("starting getAttemptsForUserAndSession"); - logger.debug("queUsrId: " + queUsrId); - logger.debug("voteSessionId: " + voteSessionId); + VoteUsrAttemptDAO.logger.debug("starting getAttemptsForUserAndSession"); + VoteUsrAttemptDAO.logger.debug("queUsrId: " + queUsrId); + VoteUsrAttemptDAO.logger.debug("voteSessionId: " + voteSessionId); HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId", + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId", queUsrId.longValue()).list(); - logger.debug("list: " + list); + VoteUsrAttemptDAO.logger.debug("list: " + list); Set userEntries = new HashSet(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - logger.debug("attempt: " + attempt); + VoteUsrAttemptDAO.logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { if (!attempt.getVoteQueContentId().toString().equals("1")) { - logger.debug("adding attempt question : " + attempt.getVoteQueContent().getQuestion()); + VoteUsrAttemptDAO.logger.debug("adding attempt question : " + + attempt.getVoteQueContent().getQuestion()); userEntries.add(attempt.getVoteQueContent().getQuestion()); } } } } - logger.debug("returning userEntries: " + userEntries); + VoteUsrAttemptDAO.logger.debug("returning userEntries: " + userEntries); return userEntries; } public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId) { - logger.debug("starting getAttemptsForUserAndSession"); - logger.debug("queUsrId: " + queUsrId); - logger.debug("voteSessionId: " + voteSessionId); + VoteUsrAttemptDAO.logger.debug("starting getAttemptsForUserAndSession"); + VoteUsrAttemptDAO.logger.debug("queUsrId: " + queUsrId); + VoteUsrAttemptDAO.logger.debug("voteSessionId: " + voteSessionId); HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId", + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId", queUsrId.longValue()).list(); - logger.debug("list: " + list); + VoteUsrAttemptDAO.logger.debug("list: " + list); String openAnswer = ""; Set userEntries = new HashSet(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - logger.debug("attempt: " + attempt); + VoteUsrAttemptDAO.logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) { if (!attempt.getVoteQueContentId().toString().equals("1")) { - logger.debug("adding attempt question : " + attempt.getVoteQueContent().getQuestion()); + VoteUsrAttemptDAO.logger.debug("adding attempt question : " + + attempt.getVoteQueContent().getQuestion()); userEntries.add(attempt.getVoteQueContent().getQuestion()); } else { - logger.debug("this is a user entered vote: " + attempt.getUserEntry()); + VoteUsrAttemptDAO.logger.debug("this is a user entered vote: " + attempt.getUserEntry()); if (attempt.getUserEntry().length() > 0) { openAnswer = attempt.getUserEntry(); - logger.debug("adding openAnswer to userEntries: "); + VoteUsrAttemptDAO.logger.debug("adding openAnswer to userEntries: "); userEntries.add(openAnswer); } @@ -407,14 +415,14 @@ } } - logger.debug("final userEntries : " + userEntries); + VoteUsrAttemptDAO.logger.debug("final userEntries : " + userEntries); return userEntries; } public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId", - queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong( + "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); return list; } @@ -424,27 +432,29 @@ public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUE_CONTENT).setLong("queUsrId", queUsrId.longValue()) - .setLong("voteQueContentId", voteQueContentId.longValue()).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUE_CONTENT).setLong("queUsrId", + queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list(); return list; } public List getUserRecords(final String userEntry) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry", + userEntry).list(); return list; } public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid) { HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list(); + List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry", + userEntry).list(); List sessionUserEntries = new ArrayList(); if (list != null && list.size() > 0) { Iterator listIterator = list.iterator(); while (listIterator.hasNext()) { VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next(); - logger.debug("attempt: " + attempt); + VoteUsrAttemptDAO.logger.debug("attempt: " + attempt); if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) { sessionUserEntries.add(attempt.getUserEntry()); } @@ -453,25 +463,23 @@ return sessionUserEntries; } - public int getSessionEntriesCount(final Long voteSessionUid) { - List result = getSession().createQuery(COUNT_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", voteSessionUid) - .list(); - logger.debug("getSessionEntriesCount: " + result); - Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0); - return resultInt.intValue(); + List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", + voteSessionUid).list(); + VoteUsrAttemptDAO.logger.debug("getSessionEntriesCount: " + result); + Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0); + return resultLong.intValue(); } public int getCompletedSessionEntriesCount(final Long voteSessionUid) { - List list = (List)getSessionUserEntries(voteSessionUid); + List list = getSessionUserEntries(voteSessionUid); int completedSessionCount = 0; - for(VoteUsrAttempt att : list) - { + for (VoteUsrAttempt att : list) { String sessionStatus = att.getVoteQueUsr().getVoteSession().getSessionStatus(); - logger.debug("this is a completed session: " + sessionStatus); - ++completedSessionCount; + VoteUsrAttemptDAO.logger.debug("this is a completed session: " + sessionStatus); + ++completedSessionCount; } - logger.debug("getCompletedSessionEntriesCount" + completedSessionCount); + VoteUsrAttemptDAO.logger.debug("getCompletedSessionEntriesCount" + completedSessionCount); return completedSessionCount; } Index: lams_tool_vote/web/WEB-INF/web.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_vote/web/WEB-INF/web.xml,v diff -u -r1.17 -r1.17.2.1 --- lams_tool_vote/web/WEB-INF/web.xml 26 Mar 2009 10:00:40 -0000 1.17 +++ lams_tool_vote/web/WEB-INF/web.xml 30 Jun 2009 03:08:11 -0000 1.17.2.1 @@ -26,13 +26,17 @@ org.lamsfoundation.lams.tool.vote.ApplicationResources
    + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/vote/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey Index: lams_tool_wiki/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/.classpath,v diff -u -r1.3 -r1.3.4.1 --- lams_tool_wiki/.classpath 21 Jan 2009 22:17:04 -0000 1.3 +++ lams_tool_wiki/.classpath 30 Jun 2009 03:08:14 -0000 1.3.4.1 @@ -2,11 +2,8 @@ - - - - + Index: lams_tool_wiki/conf/xdoclet/web-settings.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/conf/xdoclet/web-settings.xml,v diff -u -r1.2 -r1.2.2.1 --- lams_tool_wiki/conf/xdoclet/web-settings.xml 26 Mar 2009 10:00:40 -0000 1.2 +++ lams_tool_wiki/conf/xdoclet/web-settings.xml 30 Jun 2009 03:08:16 -0000 1.2.2.1 @@ -5,13 +5,17 @@ org.lamsfoundation.lams.tool.wiki.ApplicationResources + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + contextConfigLocation classpath:/org/lamsfoundation/lams/tool/wiki/dbupdates/autopatchContext.xml locatorFactorySelector - classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml + classpath:/org/lamsfoundation/lams/beanRefContext.xml parentContextKey