Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -46,7 +46,6 @@ public static final String LOAD_MONITORING_CONTENT ="loadMonitoring"; public static final String LOAD_MONITORING ="refreshMonitoring"; public static final String LOAD_MONITORING_CONTENT_EDITACTIVITY ="loadMonitoringEditActivity"; - public static final String MC_STATS_DTO ="mcStatsDTO"; public static final String LIST_ALL_GROUPS_DTO ="listAllGroupsDTO"; public static final String EXPORT_PORTFOLIO = "exportPortfolio"; public static final String INDIVIDUAL_REPORT ="individualReport"; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralMonitoringDTO.java =================================================================== diff -u -r81e4b129f71e63322c81c9016ec1ffa93f3c5944 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralMonitoringDTO.java (.../McGeneralMonitoringDTO.java) (revision 81e4b129f71e63322c81c9016ec1ffa93f3c5944) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McGeneralMonitoringDTO.java (.../McGeneralMonitoringDTO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -58,8 +58,8 @@ protected String activityTitle; protected String activityInstructions; protected String defaultOptionContent; - protected String countAllUsers; - protected String countSessionComplete; + protected Integer countAllUsers; + protected Integer countSessionComplete; protected String isPortfolioExport; protected String groupName; protected String currentMonitoredToolSession; @@ -72,7 +72,6 @@ protected String toolContentID; protected Map mapOptionsContent; protected Map summaryToolSessions; - protected Map summaryToolSessionsId; protected List listMonitoredAnswersContainerDto; protected List listUserEntries; protected String selectedToolSessionId; @@ -366,25 +365,25 @@ /** * @return Returns the countAllUsers. */ - public String getCountAllUsers() { + public Integer getCountAllUsers() { return countAllUsers; } /** * @param countAllUsers The countAllUsers to set. */ - public void setCountAllUsers(String countAllUsers) { + public void setCountAllUsers(Integer countAllUsers) { this.countAllUsers = countAllUsers; } /** * @return Returns the countSessionComplete. */ - public String getCountSessionComplete() { + public Integer getCountSessionComplete() { return countSessionComplete; } /** * @param countSessionComplete The countSessionComplete to set. */ - public void setCountSessionComplete(String countSessionComplete) { + public void setCountSessionComplete(Integer countSessionComplete) { this.countSessionComplete = countSessionComplete; } /** @@ -412,18 +411,6 @@ this.summaryToolSessions = summaryToolSessions; } /** - * @return Returns the summaryToolSessionsId. - */ - public Map getSummaryToolSessionsId() { - return summaryToolSessionsId; - } - /** - * @param summaryToolSessionsId The summaryToolSessionsId to set. - */ - public void setSummaryToolSessionsId(Map summaryToolSessionsId) { - this.summaryToolSessionsId = summaryToolSessionsId; - } - /** * @return Returns the selectionCase. */ public Long getSelectionCase() { @@ -679,7 +666,6 @@ .append("countSessionComplete: ", countSessionComplete) .append("isPortfolioExport: ", isPortfolioExport) .append("summaryToolSessions: ", summaryToolSessions) - .append("summaryToolSessionsId: ", summaryToolSessionsId) .append("currentMonitoredToolSession: ", currentMonitoredToolSession) .append("groupName: ", groupName) .append("listMonitoredAnswersContainerDto: ", listMonitoredAnswersContainerDto) Fisheye: Tag dea5004371152a95bec9fc2db87a455fa84c0887 refers to a dead (removed) revision in file `lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McStatsDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java (.../McUtils.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -223,79 +223,7 @@ return false; } - /** - * builds a map from a list - * convertToMap(List sessionsList) - * - * @param sessionsList - * @return Map - */ - public static Map convertToMap(List sessionsList, String listType) - { - Map map= new TreeMap(new McComparator()); - logger.debug("listType: " + listType); - - Iterator listIterator=sessionsList.iterator(); - Long mapIndex=new Long(1); - - - while (listIterator.hasNext()) - { - if (listType.equals("String")) - { - String text=(String)listIterator.next(); - map.put(mapIndex.toString(), text); - } - else if (listType.equals("Long")) - { - Long LongValue=(Long)listIterator.next(); - map.put(mapIndex.toString(), LongValue); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - - /** - * convertToMap(List sessionsList) - * - * builds a String based map from a list - * - * @param sessionsList - * @return Map - */ - public static Map convertToStringMap(List sessionsList, String listType) - { - Map map= new TreeMap(new McComparator()); - logger.debug("listType: " + listType); - - Iterator listIterator=sessionsList.iterator(); - Long mapIndex=new Long(1); - - - while (listIterator.hasNext()) - { - if (listType.equals("String")) - { - logger.debug("listType String"); - String text=(String)listIterator.next(); - map.put(mapIndex.toString(), text); - } - else if (listType.equals("Long")) - { - logger.debug("listType Long"); - Long LongValue=(Long)listIterator.next(); - map.put(mapIndex.toString(), LongValue.toString()); - } - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - - /** * find out if the content is in use or not. If it is in use, the author can not modify it. * The idea of content being in use is, once any one learner starts using a particular content * that content should become unmodifiable. Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcSessionDAO.java (.../IMcSessionDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -73,15 +73,8 @@ public void updateMcSession(McSession mcSession); /** - *

Delete the given instance of McSession with the - * given identifier uid - * - * @param uid an identifier for the McSession instance. + * Delete the given instance of McSession */ - public void removeMcSessionByUID(Long uid); - - public void removeMcSessionById(Long mcSessionId); - public void removeMcSession(McSession mcSession); @@ -95,31 +88,5 @@ */ public McSession getMcSessionByUser(Long userId); - - /** - *

Creates and persists an instance of McQueUsr which is associated - * with the McSession with tool session id mcSessionId

- * - * @param mcSessionId The tool session id - * @param user The instance of McQueUsr - */ - public void addMcUsers(Long mcSessionId, McQueUsr user); - - /** - * Returns a list of tool session ids which are associated with this - * instance of McContent. - - * @param nbContent The instance of McContent in which you want the list of toolSessionIds - * @return a list of tool session Ids - */ - public List getSessionsFromContent(McContent mcContent); - - public List getSessionNamesFromContent(McContent mcContent); - - public int countSessionComplete(); - - public int countSessionComplete(McContent mcContent); - - public int countSessionIncomplete(); } \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java =================================================================== diff -u -r81e4b129f71e63322c81c9016ec1ffa93f3c5944 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java (.../IMcUploadedFileDAO.java) (revision 81e4b129f71e63322c81c9016ec1ffa93f3c5944) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUploadedFileDAO.java (.../IMcUploadedFileDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -50,9 +50,7 @@ public void deleteUploadFile(McUploadedFile mcUploadedFile); - public List retrieveMcUploadedFiles(McContent mc); + public List retrieveMcUploadedFiles(McContent mc); - public void cleanUploadedFilesMetaData(); - public void flush(); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcUserDAO.java (.../IMcUserDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -71,22 +71,6 @@ */ public void removeMcUser(McQueUsr mcUser); - /** - *

Delete the given instance of McQueUsr with the - * given user id userId - * - * @param userId The mc user id. - */ - public void removeMcUserById(Long userId); - - public List getMcUserBySessionOnly(final McSession mcSession); - - public int getTotalNumberOfUsers(McContent mcContent); - - public int getTotalNumberOfUsers(); - - public int countUserComplete(McContent mcContent); - - /** Get the max, min and average mark (in that order) for a session */ + /** Get the max, min and average mark (in that order) for a session */ public Integer[] getMarkStatisticsForSession(Long sessionUid); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McSessionDAO.java (.../McSessionDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -42,19 +42,11 @@ public class McSessionDAO extends HibernateDaoSupport implements IMcSessionDAO { - private static final String FIND_MC_SESSION_CONTENT = "from " + McSession.class.getName() + " as mcs where mc_session_id=?"; - private static final String LOAD_MCSESSION_BY_USER = "select ms from McSession ms left join fetch " + "ms.mcQueUsers user where user.queUsrId=:userId"; - private static final String GET_SESSIONS_FROM_CONTENT = "select ms.mcSessionId from McSession ms where ms.mcContent=:mcContent"; + private static final String LOAD_MCSESSION_BY_MCSESSIONID = "from McSession mcs where mcs.mcSessionId=?"; - private static final String COUNT_SESSION_COMPLETE = "from mcSession in class McSession where mcSession.sessionStatus='COMPLETED'"; - - private static final String COUNT_SESSION_INCOMPLETE = "from mcSession in class McSession where mcSession.sessionStatus='INCOMPLETE'"; - - private static final String GET_SESSIONNAMES_FROM_CONTENT = "select mcs.session_name from McSession mcs where mcs.mcContent=:mcContent order by mcs.mcSessionId"; - public McSession getMcSessionByUID(Long uid) { return (McSession) this.getHibernateTemplate() @@ -63,10 +55,8 @@ public McSession findMcSessionById(Long mcSessionId) { - String query = "from McSession mcs where mcs.mcSessionId=?"; - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(query) + List list = getSession().createQuery(LOAD_MCSESSION_BY_MCSESSIONID) .setLong(0,mcSessionId.longValue()) .list(); @@ -77,57 +67,6 @@ return null; } - public int countSessionComplete() - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(COUNT_SESSION_COMPLETE) - .list(); - - if(list != null && list.size() > 0){ - return list.size(); - } - else return 0; - } - - - public int countSessionComplete(McContent mcContent) - { - logger.debug("starting countSessionComplete: " + mcContent); - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(COUNT_SESSION_COMPLETE) - .list(); - - int sessionCount=0; - if(list != null && list.size() > 0){ - McSession mcSession = (McSession) list.get(0); - logger.debug("mcSession: " + mcSession); - logger.debug("local session's content uid versus incoming content uid: " + - mcSession.getMcContent().getUid().intValue() + " versus " + mcContent.getUid().intValue()); - - if (mcSession.getMcContent().getUid().intValue() == mcContent.getUid().intValue()) - { - ++sessionCount; - } - } - logger.debug("sessionCount: " + sessionCount); - return sessionCount; - - } - - - public int countSessionIncomplete() - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(COUNT_SESSION_INCOMPLETE) - .list(); - - if(list != null && list.size() > 0){ - return list.size(); - } - else return 0; - } - - public void saveMcSession(McSession mcSession) { this.getHibernateTemplate().save(mcSession); @@ -140,42 +79,12 @@ this.getHibernateTemplate().update(mcSession); } - - public void removeMcSessionByUID(Long uid) - { - McSession ms = (McSession)getHibernateTemplate().get(McSession.class, uid); - this.getHibernateTemplate().delete(ms); - } - - public void removeMcSessionById(Long mcSessionId) - { - String query = "from McSession as mcs where mcs.mcSessionId ="; - - HibernateTemplate templ = this.getHibernateTemplate(); - if ( mcSessionId != null) { - List list = getSession().createQuery(FIND_MC_SESSION_CONTENT) - .setLong(0,mcSessionId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - McSession mcs = (McSession) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(mcs); - templ.flush(); - } - } - - - } - public void removeMcSession(McSession mcSession) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(mcSession); } - - public McSession getMcSessionByUser(final Long userId) { return (McSession) getHibernateTemplate().execute(new HibernateCallback() @@ -191,36 +100,4 @@ }); } - - public void removeMcUsers(McSession mcSession) - { - this.getHibernateTemplate().deleteAll(mcSession.getMcQueUsers()); - } - - - public void addMcUsers(Long mcSessionId, McQueUsr user) - { - McSession session = findMcSessionById(mcSessionId); - user.setMcSession(session); - session.getMcQueUsers().add(user); - this.getHibernateTemplate().saveOrUpdate(user); - this.getHibernateTemplate().saveOrUpdate(session); - - } - - - public List getSessionsFromContent(McContent mcContent) - { - return (getHibernateTemplate().findByNamedParam(GET_SESSIONS_FROM_CONTENT, - "mcContent", - mcContent)); - } - - public List getSessionNamesFromContent(McContent mcContent) - { - return (getHibernateTemplate().findByNamedParam(GET_SESSIONNAMES_FROM_CONTENT, - "mcContent", - mcContent)); - } - } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java =================================================================== diff -u -r81e4b129f71e63322c81c9016ec1ffa93f3c5944 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java (.../McUploadedFileDAO.java) (revision 81e4b129f71e63322c81c9016ec1ffa93f3c5944) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUploadedFileDAO.java (.../McUploadedFileDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -23,32 +23,23 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.mc.dao.hibernate; -import java.util.Iterator; import java.util.List; -import org.apache.log4j.Logger; import org.hibernate.FlushMode; import org.lamsfoundation.lams.tool.mc.dao.IMcUploadedFileDAO; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; -import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; /** * @author Ozgur Demirtas - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class McUploadedFileDAO extends HibernateDaoSupport implements IMcUploadedFileDAO { - static Logger logger = Logger.getLogger(McUploadedFileDAO.class.getName()); private static final String GET_UPLOADED_FILES = "from McUploadedFile mcUploadedFile where mcUploadedFile.mcContent.mcContentId = :contentId"; - private static final String DELETE_FILES_META_DATA = "from mcUploadedFile in class McUploadedFile"; - public McUploadedFile getUploadedFileById(long submissionId) { return (McUploadedFile) this.getHibernateTemplate() @@ -92,29 +83,6 @@ } - public void cleanUploadedFilesMetaData() - { - /* - String query = "from uploadedFile in class org.lamsfoundation.lams.tool.mc.McUploadedFile"; - this.getSession().setFlushMode(FlushMode.AUTO); - this.getHibernateTemplate().delete(query); - */ - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(DELETE_FILES_META_DATA) - .list(); - - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - McUploadedFile mcFile=(McUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(mcFile); - templ.flush(); - } - } - } - public void removeUploadFile(Long submissionId) { if (submissionId != null ) { @@ -131,10 +99,10 @@ } } - public List retrieveMcUploadedFiles(McContent mc) + public List retrieveMcUploadedFiles(McContent mc) { - List listFilenames=null; - listFilenames=(getHibernateTemplate().findByNamedParam(GET_UPLOADED_FILES, "contentId", mc.getMcContentId())); + List listFilenames= (List) + (getHibernateTemplate().findByNamedParam(GET_UPLOADED_FILES, "contentId", mc.getMcContentId())); return listFilenames; } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McUserDAO.java (.../McUserDAO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -39,15 +39,14 @@ */ public class McUserDAO extends HibernateDaoSupport implements IMcUserDAO { - private static final String FIND_MC_USR_CONTENT = "from " + McQueUsr.class.getName() + " as mcu where que_usr_id=?"; - - private static final String COUNT_USERS_IN_SESSION = "select mu.queUsrId from McQueUsr mu where mu.mcSession= :mcSession"; - - private static final String LOAD_USER_FOR_SESSION = "from mcQueUsr in class McQueUsr where mcQueUsr.mcSessionId= :mcSessionId"; - private static final String CALC_MARK_STATS_FOR_SESSION = "select max(mu.lastAttemptTotalMark), min(mu.lastAttemptTotalMark), avg(mu.lastAttemptTotalMark)" +" from McQueUsr mu where mu.mcSessionId = :mcSessionUid"; + private static final String GET_USER_BY_USER_ID_SESSION = "from mcQueUsr in class McQueUsr where mcQueUsr.queUsrId=:queUsrId and mcQueUsr.mcSessionId=:mcSessionId"; + + private static final String GET_USER_BY_USER_ID = "from McQueUsr user where user.queUsrId=?"; + + public McQueUsr getMcUserByUID(Long uid) { return (McQueUsr) this.getHibernateTemplate() @@ -57,10 +56,7 @@ public McQueUsr findMcUserById(Long userId) { - String query = "from McQueUsr user where user.queUsrId=?"; - - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(query) + List list = getSession().createQuery(GET_USER_BY_USER_ID) .setLong(0,userId.longValue()) .list(); @@ -71,22 +67,10 @@ return null; } - - public List getMcUserBySessionOnly(final McSession mcSession) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(LOAD_USER_FOR_SESSION) - .setLong("mcSessionId", mcSession.getUid().longValue()) - .list(); - return list; - } - public McQueUsr getMcUserBySession(final Long queUsrId, final Long mcSessionId) { - String strGetUser = "from mcQueUsr in class McQueUsr where mcQueUsr.queUsrId=:queUsrId and mcQueUsr.mcSessionId=:mcSessionId"; - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(strGetUser) + List list = getSession().createQuery(GET_USER_BY_USER_ID_SESSION) .setLong("queUsrId", queUsrId.longValue()) .setLong("mcSessionId", mcSessionId.longValue()) .list(); @@ -110,110 +94,12 @@ this.getHibernateTemplate().update(mcUser); } - - public void removeMcUserById(Long userId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - if ( userId != null) { - List list = getSession().createQuery(FIND_MC_USR_CONTENT) - .setLong(0,userId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - McQueUsr mcu = (McQueUsr) list.get(0); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(mcu); - templ.flush(); - } - } - - } - - public void removeMcUser(McQueUsr mcUser) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(mcUser); } - - public int getTotalNumberOfUsers() { - String query="from obj in class McQueUsr"; - return this.getHibernateTemplate().find(query).size(); - } - - - public int getTotalNumberOfUsers(McContent mcContent) - { - logger.debug("starting getTotalNumberOfUsers: " + mcContent); - String strGetUser = "from mcQueUsr in class McQueUsr"; - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(strGetUser) - .list(); - logger.debug("strGetUser: " + strGetUser); - logger.debug("list: " + list); - - - int totalUserCount=0; - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - McQueUsr usr=(McQueUsr)listIterator.next(); - logger.debug("usr: " + usr); - logger.debug("local usr content uid versus incoming content uid: " + - usr.getMcSession().getMcContent().getUid().intValue() + " versus " + mcContent.getUid().intValue()); - - if (usr.getMcSession().getMcContent().getUid().intValue() == mcContent.getUid().intValue()) - { - logger.debug("increasing user count"); - ++totalUserCount; - } - } - } - - logger.debug("final totalUserCount: " + totalUserCount); - return totalUserCount; - } - - - public int countUserComplete(McContent mcContent) - { - logger.debug("starting countUserComplete: " + mcContent); - String strGetUser = "from mcQueUsr in class McQueUsr"; - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(strGetUser) - .list(); - logger.debug("strGetUser: " + strGetUser); - logger.debug("list: " + list); - - - int totalUserCount=0; - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - McQueUsr usr=(McQueUsr)listIterator.next(); - logger.debug("usr: " + usr); - logger.debug("local usr content uid versus incoming content uid: " + - usr.getMcSession().getMcContent().getUid().intValue() + " versus " + mcContent.getUid().intValue()); - - if (usr.getMcSession().getMcContent().getUid().intValue() == mcContent.getUid().intValue()) - { - if (usr.getMcSession().getSessionStatus().equals("COMPLETED")) - { - logger.debug("this user's session is COMPLETED, increasing user count"); - ++totalUserCount; - } - - } - } - } - - logger.debug("final totalUserCount: " + totalUserCount); - return totalUserCount; - } - /** Get the max, min and average mark (in that order) for a session */ public Integer[] getMarkStatisticsForSession(Long sessionUid) { Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -133,8 +133,6 @@ public void updateMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException; - public List getMcUserBySessionOnly(final McSession mcSession) throws McApplicationException; - public List populateCandidateAnswersDTO(Long mcQueContentId) throws McApplicationException; public McSession getMcSessionByUID(Long uid) throws McApplicationException; @@ -145,16 +143,10 @@ public void deleteMcById(Long mcId) throws McApplicationException; - public void deleteMcSession(McSession mcSession) throws McApplicationException; - - public List getSessionNamesFromContent(McContent mcContent) throws McApplicationException; - public void removeAttempt (McUsrAttempt attempt) throws McApplicationException; public void deleteMcQueUsr(McQueUsr mcQueUsr) throws McApplicationException; - public int countUserComplete(McContent mcContent) throws McApplicationException; - public List findMcOptionsContentByQueId(Long mcQueContentId) throws McApplicationException; public void saveMcOptionsContent(McOptsContent mcOptsContent) throws McApplicationException; @@ -169,10 +161,6 @@ public User getCurrentUserData(String username) throws McApplicationException; - public int getTotalNumberOfUsers() throws McApplicationException; - - public int getTotalNumberOfUsers(McContent mcContent) throws McApplicationException; - public Lesson getCurrentLesson(long lessonId) throws McApplicationException; public void saveMcContent(McContent mc) throws McApplicationException; @@ -225,8 +213,6 @@ public McQueContent getToolDefaultQuestionContent(long contentId) throws McApplicationException; - public List getToolSessionsForContent(McContent mc); - public ITicket getRepositoryLoginTicket() throws McApplicationException; public void deleteFromRepository(Long uuid, Long versionID); @@ -235,28 +221,18 @@ public InputStream downloadFile(Long uuid, Long versionID) throws McApplicationException; - public void cleanUploadedFilesMetaData() throws McApplicationException; - public void persistFile(String uuid, boolean isOnlineFile, String fileName, McContent mcContent) throws McApplicationException; public List getAttemptByAttemptOrder(final Long queUsrId, final Long mcQueContentId, final Integer attemptOrder) throws McApplicationException; - public int countSessionComplete() throws McApplicationException; - - public int countSessionComplete(McContent mcContent) throws McApplicationException; - public McSession findMcSessionById(Long mcSessionId) throws McApplicationException; - public int countSessionIncomplete() throws McApplicationException; + public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException; - public List getNextAvailableDisplayOrder(final long mcContentId) throws McApplicationException; - public NodeKey uploadFile(InputStream istream, String filename, String contentType, String fileType) throws RepositoryCheckedException; public NodeKey copyFile(Long uuid) throws RepositoryCheckedException; - public List getSessionsFromContent(McContent mcContent) throws McApplicationException; - public List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException; public List findMcOptionNamesByQueId(Long mcQueContentId) throws McApplicationException; @@ -274,7 +250,7 @@ public void removeFile(Long submissionId) throws McApplicationException; - public List retrieveMcUploadedFiles(McContent mcContent) throws McApplicationException; + public List retrieveMcUploadedFiles(McContent mcContent) throws McApplicationException; /** * Return the top, lowest and average mark for all learners for one particular tool session. Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -30,8 +30,6 @@ import java.util.TreeSet; import java.util.Vector; -import javax.servlet.http.HttpServletRequest; - import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.AccessDeniedException; import org.lamsfoundation.lams.contentrepository.FileException; @@ -79,7 +77,6 @@ import org.lamsfoundation.lams.tool.mc.pojos.McSession; import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt; -import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -741,21 +738,6 @@ } - public List getMcUserBySessionOnly(final McSession mcSession) throws McApplicationException - { - try - { - return mcUserDAO.getMcUserBySessionOnly(mcSession); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is retrieving users by session: " - + e.getMessage(), - e); - } - } - - public McContent retrieveMcBySessionId(Long mcSessionId) throws McApplicationException { try @@ -770,22 +752,6 @@ } } - public List getSessionNamesFromContent(McContent mcContent) throws McApplicationException - { - try - { - return mcSessionDAO.getSessionNamesFromContent(mcContent); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is getting session names from content: " - + e.getMessage(), - e); - } - } - - - public void updateMc(McContent mc) throws McApplicationException { try @@ -842,63 +808,7 @@ + e.getMessage(),e); } } - - public int countSessionComplete(McContent mcContent) throws McApplicationException - { - try - { - return mcSessionDAO.countSessionComplete(mcContent); - } - catch(DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is counting incomplete sessions" - + e.getMessage(),e); - } - } - - - public int countSessionComplete() throws McApplicationException - { - try - { - return mcSessionDAO.countSessionComplete(); - } - catch(DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is counting incomplete sessions" - + e.getMessage(),e); - } - } - - public int countSessionIncomplete() throws McApplicationException - { - try - { - return mcSessionDAO.countSessionIncomplete(); - } - catch(DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is counting incomplete sessions" - + e.getMessage(),e); - } - } - - public void deleteMcSession(McSession mcSession) throws McApplicationException - { - try - { - mcSessionDAO.removeMcSession(mcSession); - } - catch(DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is deleting" - + " the mc session: " - + e.getMessage(),e); - } - } - - public void removeAttempt (McUsrAttempt attempt) throws McApplicationException { try @@ -1068,20 +978,6 @@ } } - public List getSessionsFromContent(McContent mcContent) throws McApplicationException - { - try - { - return mcSessionDAO.getSessionsFromContent(mcContent); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is getting" - + " the mc sessions list: " - + e.getMessage(),e); - } - } - public List findMcOptionCorrectByQueId(Long mcQueContentId) throws McApplicationException { try @@ -1157,53 +1053,7 @@ } } - - public int countUserComplete(McContent mcContent) throws McApplicationException - { - try - { - return mcUserDAO.countUserComplete(mcContent); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is retrieving completed user count: " - + e.getMessage(), - e); - } - } - - - - public int getTotalNumberOfUsers(McContent mcContent) throws McApplicationException - { - try - { - return mcUserDAO.getTotalNumberOfUsers(mcContent); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is retrieving total number of McQueUsr: " - + e.getMessage(), - e); - } - } - - - public int getTotalNumberOfUsers() throws McApplicationException - { - try - { - return mcUserDAO.getTotalNumberOfUsers(); - } - catch (DataAccessException e) - { - throw new McApplicationException("Exception occured when lams is retrieving total number of McQueUsr: " - + e.getMessage(), - e); - } - } - - public User getCurrentUserData(String username) throws McApplicationException + public User getCurrentUserData(String username) throws McApplicationException { try { @@ -1971,15 +1821,7 @@ } - public List getToolSessionsForContent(McContent mc) - { - logger.debug("attempt retrieving listToolSessionIds for : " + mc); - List listToolSessionIds=mcSessionDAO.getSessionsFromContent(mc); - return listToolSessionIds; - } - - - public void removeAttachment(McContent content, McUploadedFile attachment) throws RepositoryCheckedException + public void removeAttachment(McContent content, McUploadedFile attachment) throws RepositoryCheckedException { try { @@ -2129,18 +1971,6 @@ } /** - * - * removes all the entries in the uploaded files table - */ - public void cleanUploadedFilesMetaData() throws McApplicationException { - logger.debug("attempt cleaning up uploaded file meta data table from the db"); - mcUploadedFileDAO.cleanUploadedFilesMetaData(); - logger.debug("files meta data has been cleaned up"); - } - - - - /** * @return Returns the logger. */ public static Logger getLogger() { @@ -2474,7 +2304,7 @@ - public List retrieveMcUploadedFiles(McContent mc) throws McApplicationException { + public List retrieveMcUploadedFiles(McContent mc) throws McApplicationException { try { return mcUploadedFileDAO.retrieveMcUploadedFiles(mc); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== diff -u -r1b2382ace1129a3f32efaee5d802e1dbc9b9f1b7 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision 1b2382ace1129a3f32efaee5d802e1dbc9b9f1b7) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -60,6 +60,7 @@ import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; import org.lamsfoundation.lams.tool.mc.pojos.McSession; +import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; import org.lamsfoundation.lams.util.WebUtil; @@ -185,55 +186,18 @@ /** - * submitSession - * - * enables getting monitoring data for different sessions - * - * @param mapping * @param form * @param request - * @param response * @param mcService * @param mcGeneralMonitoringDTO - * @return * @throws IOException * @throws ServletException */ - public ActionForward submitSession(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response, - IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO - ) throws IOException, - ServletException - { - logger.debug("calling submitSession...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); - commonSubmitSessionCode(form, request, mcService,mcGeneralMonitoringDTO); - logger.debug("post commonSubmitSessionCode: " +mcGeneralMonitoringDTO); - return (mapping.findForward(LOAD_MONITORING)); - } - - - /** - * commonSubmitSessionCode(ActionForm form, HttpServletRequest request,IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) - * - * @param form - * @param request - * @param mcService - * @param mcGeneralMonitoringDTO - * @throws IOException - * @throws ServletException - */ - protected void commonSubmitSessionCode(ActionForm form, HttpServletRequest request,IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, ServletException + protected ActionForward commonSubmitSessionCode(McMonitoringForm mcMonitoringForm, HttpServletRequest request, ActionMapping mapping, + IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, ServletException { logger.debug("starting commonSubmitSessionCode...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); - logger.debug("mcService:" + mcService); - McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - repopulateRequestParameters(request, mcMonitoringForm, mcGeneralMonitoringDTO); logger.debug("done repopulateRequestParameters"); @@ -285,20 +249,8 @@ mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); - - Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); + mcGeneralMonitoringDTO.setSummaryToolSessions(populateToolSessions(mcContent)); - Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); - logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); - mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, mcService, mcGeneralMonitoringDTO); - logger.debug("post initStatsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - /*setting editable screen properties*/ McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); mcGeneralAuthoringDTO.setActivityTitle(mcContent.getTitle()); @@ -353,7 +305,7 @@ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); logger.debug("attachmentList: " + attachmentList); mcGeneralMonitoringDTO.setAttachmentList(attachmentList); mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); @@ -395,7 +347,7 @@ } /* ... till here*/ - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO); MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); @@ -407,195 +359,40 @@ logger.debug("dumping request level controlllers, REQUEST selectionCase: " + request.getAttribute(SELECTION_CASE)); + + return (mapping.findForward(LOAD_MONITORING_CONTENT)); + } - - /** - * refreshSummaryData(HttpServletRequest request, McContent mcContent, IMcService mcService, - boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId, - boolean showUserEntriesBySession, McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO, - McGeneralMonitoringDTO mcGeneralMonitoringDTO, ExportPortfolioDTO exportPortfolioDTO) - - * refreshes summary data - * - * @param request - * @param mcContent - * @param mcService - * @param isUserNamesVisible - * @param isLearnerRequest - * @param currentSessionId - * @param userId - * @param showUserEntriesBySession - * @param mcGeneralLearnerFlowDTO - * @param mcGeneralMonitoringDTO - * @param exportPortfolioDTO - */ - public void refreshSummaryData(HttpServletRequest request, McContent mcContent, IMcService mcService, - boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId, - boolean showUserEntriesBySession, McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO, - McGeneralMonitoringDTO mcGeneralMonitoringDTO, ExportPortfolioDTO exportPortfolioDTO) + /** + * Populates a sorted map of the tool session where the key is the mcSessionId and the value is name of the session. + * If no sessions exists, there will be a single entry "None", otherwise on the end of the list will be the entry "All" + */ + public static Map populateToolSessions(McContent mcContent) { - logger.debug("doing refreshSummaryData." + mcGeneralLearnerFlowDTO); - logger.debug("mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); - logger.debug("exportPortfolioDTO:" + exportPortfolioDTO); - - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from session: " + mcService); + Map sessionsMap = new TreeMap(); + Iterator iter = mcContent.getMcSessions().iterator(); + while (iter.hasNext()) { + McSession elem = (McSession) iter.next(); + sessionsMap.put(elem.getMcSessionId().toString(), elem.getSession_name() ); } - logger.debug("mcService: " + mcService); - - logger.debug("isUserNamesVisible: " + isUserNamesVisible); - logger.debug("isLearnerRequest: " + isLearnerRequest); - - /* this section is related to summary tab. Starts here. */ - Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - if (mcGeneralMonitoringDTO != null) - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - if (mcGeneralMonitoringDTO != null) - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - - String userExceptionNoToolSessions=mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions: " + userExceptionNoToolSessions); - if (exportPortfolioDTO != null) - { - exportPortfolioDTO.setUserExceptionNoToolSessions(userExceptionNoToolSessions); - } - - Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); - logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); - logger.debug("currentSessionId: " + currentSessionId); - - if ((currentSessionId != null) && (!currentSessionId.equals("All"))) - { - McSession mcSession= mcService.retrieveMcSession(new Long(currentSessionId)); - logger.debug("mcSession:" + mcSession); - if (mcGeneralMonitoringDTO != null) - mcGeneralMonitoringDTO.setGroupName(mcSession.getSession_name()); - } - else - { - mcGeneralMonitoringDTO.setGroupName("All Groups"); - } - - logger.debug("using allUsersData to retrieve data: " + isUserNamesVisible); - - List listMonitoredAnswersContainerDTO = new LinkedList(); - logger.debug("listMonitoredAnswersContainerDTO: " + listMonitoredAnswersContainerDTO); - /* ends here. */ - - logger.debug("decide processing user entered values based on isLearnerRequest: " + isLearnerRequest); - - if (exportPortfolioDTO != null) - { - logger.debug("placing dtos within the exportPortfolioDTO: "); - exportPortfolioDTO.setListMonitoredAnswersContainerDto(listMonitoredAnswersContainerDTO); - } - - - if (mcGeneralMonitoringDTO != null) - { - mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); - mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); - mcGeneralMonitoringDTO.setSelectionCase(new Long(2)); - mcGeneralMonitoringDTO.setCurrentMonitoredToolSession("All"); - mcGeneralMonitoringDTO.setListMonitoredAnswersContainerDto(listMonitoredAnswersContainerDTO); - - mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString()); - } - - logger.debug("final mcGeneralLearnerFlowDTO: " + mcGeneralLearnerFlowDTO); - logger.debug("final mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - if (isContentInUse == true) + if (sessionsMap.isEmpty()) { - logger.debug("monitoring url does not allow editActivity since the content is in use."); - mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + sessionsMap.put("None", "None"); } + else + { + sessionsMap.put("All" , "All"); + } + + if ( logger.isDebugEnabled() ) + logger.debug("final sessionsMap:" + sessionsMap); - prepareReflectionData(request, mcContent, mcService, null, false, "All"); - - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - } - else - { - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - } + return sessionsMap; - /**getting instructions screen content from here... */ - mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); - mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); - logger.debug("attachmentList: " + attachmentList); - mcGeneralMonitoringDTO.setAttachmentList(attachmentList); - mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); - /** ...till here **/ - - - logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - - EditActivityDTO editActivityDTO = new EditActivityDTO(); - isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); - } - request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - - - /*find out if there are any reflection entries, from here*/ - boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); - logger.debug("notebookEntriesExist : " + notebookEntriesExist); - - if (notebookEntriesExist) - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - - userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); - - if (userExceptionNoToolSessions.equals("true")) - { - logger.debug("there are no online student activity but there are reflections : "); - request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - } - } - else - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); - } - /* ... till here*/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); - - MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); } - - /** * ActionForward submitSession(ActionMapping mapping, ActionForm form, @@ -618,16 +415,9 @@ HttpServletResponse response) throws IOException,ServletException { - logger.debug("dispathcing submitSession.."); + logger.debug("dispatching submitSession.."); IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("mcService: " +mcService); - - McGeneralMonitoringDTO mcGeneralMonitoringDTO= new McGeneralMonitoringDTO(); - - commonSubmitSessionCode(form, request, mcService,mcGeneralMonitoringDTO); - logger.debug("post commonSubmitSessionCode: " + mcGeneralMonitoringDTO); - - return (mapping.findForward(LOAD_MONITORING_CONTENT)); + return commonSubmitSessionCode((McMonitoringForm) form, request, mapping, mcService, new McGeneralMonitoringDTO() ); } @@ -696,11 +486,7 @@ mcAuthoringForm.setTitle(mcContent.getTitle()); mcGeneralAuthoringDTO.setActivityInstructions(mcContent.getInstructions()); - - sessionMap.put(ACTIVITY_TITLE_KEY, mcContent.getTitle()); - sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcContent.getInstructions()); - - + /* determine whether the request is from Monitoring url Edit Activity*/ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); logger.debug("sourceMcStarter: " + sourceMcStarter); @@ -788,7 +574,7 @@ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); logger.debug("attachmentList: " + attachmentList); mcGeneralMonitoringDTO.setAttachmentList(attachmentList); mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); @@ -821,16 +607,15 @@ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); } /* ... till here*/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO); MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); logger.debug("forwarding to LOAD_MONITORING_CONTENT: " + LOAD_MONITORING_CONTENT); - return mapping.findForward(LOAD_MONITORING_CONTENT); - } + return mapping.findForward(LOAD_MONITORING_CONTENT); + } @@ -1128,7 +913,7 @@ mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); logger.debug("attachmentList: " + attachmentList); mcGeneralMonitoringDTO.setAttachmentList(attachmentList); mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); @@ -1156,8 +941,7 @@ request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); } /* ... till here*/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO); MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); logger.debug("ending setupCommonScreenData, mcContent " + mcContent); @@ -4697,258 +4481,7 @@ request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); } - - /** - * initSummaryContent(String toolContentID, - HttpServletRequest request, - IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) - * - * @param toolContentID - * @param request - * @param mcService - * @param mcGeneralMonitoringDTO - * @throws IOException - * @throws ServletException - */ - public void initSummaryContent(String toolContentID, - HttpServletRequest request, - IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, - ServletException - { - logger.debug("start initSummaryContent...toolContentID: " + toolContentID); - logger.debug("dispatching getSummary...mcGeneralMonitoringDTO:" + mcGeneralMonitoringDTO); - - logger.debug("mcService: " + mcService); - logger.debug("toolContentID: " + toolContentID); - - McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); - logger.debug("existing mcContent:" + mcContent); - - /* this section is related to summary tab. Starts here. */ - Map summaryToolSessions=MonitoringUtil.populateToolSessions(request, mcContent, mcService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - mcGeneralMonitoringDTO.setSummaryToolSessions(summaryToolSessions); - - Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, mcContent, mcService); - logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); - mcGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); - /* ends here. */ - - /*true means there is at least 1 response*/ - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - - prepareReflectionData(request, mcContent, mcService, null, false, "All"); - - EditActivityDTO editActivityDTO = new EditActivityDTO(); - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); - } - request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - - /**getting instructions screen content from here... */ - mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); - mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); - logger.debug("attachmentList: " + attachmentList); - mcGeneralMonitoringDTO.setAttachmentList(attachmentList); - mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); - /** ...till here **/ - - - mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); - - logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - - /*find out if there are any reflection entries, from here*/ - boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); - logger.debug("notebookEntriesExist : " + notebookEntriesExist); - - if (notebookEntriesExist) - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - - String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); - - if (userExceptionNoToolSessions.equals("true")) - { - logger.debug("there are no online student activity but there are reflections : "); - request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - } - } - else - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); - } - /* ... till here*/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); - - MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); - - logger.debug("end initSummaryContent..."); - } - - - /** - * void initStatsContent(String toolContentID, - HttpServletRequest request, - IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) - * - * @param toolContentID - * @param request - * @param mcService - * @param mcGeneralMonitoringDTO - * @throws IOException - * @throws ServletException - */ - public void initStatsContent(String toolContentID, - HttpServletRequest request, - IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) throws IOException, - ServletException - { - logger.debug("starting initStatsContent...:" + toolContentID); - logger.debug("dispatching getStats..." + request); - logger.debug("mcService: " + mcService); - - McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); - logger.debug("existing mcContent:" + mcContent); - - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - - - refreshStatsData(request, mcService,mcGeneralMonitoringDTO); - logger.debug("post refreshStatsData, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO ); - - prepareReflectionData(request, mcContent, mcService, null, false, "All"); - - EditActivityDTO editActivityDTO = new EditActivityDTO(); - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); - } - request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - - /**getting instructions screen content from here... */ - mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); - mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); - logger.debug("attachmentList: " + attachmentList); - mcGeneralMonitoringDTO.setAttachmentList(attachmentList); - mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); - /** ...till here **/ - - - mcGeneralMonitoringDTO.setCurrentMonitoringTab("stats"); - - logger.debug("end of refreshSummaryData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - - - /*find out if there are any reflection entries, from here*/ - boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); - logger.debug("notebookEntriesExist : " + notebookEntriesExist); - - if (notebookEntriesExist) - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - - String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); - - if (userExceptionNoToolSessions.equals("true")) - { - logger.debug("there are no online student activity but there are reflections : "); - request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - } - } - else - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); - } - /* ... till here*/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); - - MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); - - logger.debug("ending initStatsContent..."); - } - - - /** - * void refreshStatsData(HttpServletRequest request, IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) - * - * @param request - * @param mcService - * @param mcGeneralMonitoringDTO - */ - public void refreshStatsData(HttpServletRequest request, IMcService mcService, - McGeneralMonitoringDTO mcGeneralMonitoringDTO) - { - logger.debug("starting refreshStatsData: " + mcService); - /* it is possible that no users has ever logged in for the activity yet*/ - if (mcService == null) - { - logger.debug("will retrieve mcService"); - mcService = McServiceProxy.getMcService(getServlet().getServletContext()); - logger.debug("retrieving mcService from session: " + mcService); - } - - int countAllUsers=mcService.getTotalNumberOfUsers(); - logger.debug("countAllUsers: " + countAllUsers); - - if (countAllUsers == 0) - { - logger.debug("error: countAllUsers is 0"); - mcGeneralMonitoringDTO.setUserExceptionNoStudentActivity(new Boolean(true).toString()); - } - - mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers).toString()); - - int countSessionComplete=mcService.countSessionComplete(); - logger.debug("countSessionComplete: " + countSessionComplete); - mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); - - - logger.debug("end of refreshStatsData, mcGeneralMonitoringDTO" + mcGeneralMonitoringDTO); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - } - - - - /** + /** * void repopulateRequestParameters(HttpServletRequest request, McMonitoringForm mcMonitoringForm, McGeneralMonitoringDTO mcGeneralMonitoringDTO) * @@ -5057,7 +4590,7 @@ } /* ... till here*/ - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); + MonitoringUtil.setSessionUserCount(mcContent, mcGeneralMonitoringDTO); MonitoringUtil.generateGroupsSessionData(request, mcService, mcContent); MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); logger.debug("ending setupCommonScreenData, mcContent " + mcContent); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java =================================================================== diff -u -rc3b793637eab6ae0c12968c3c07f9993c1ef6f16 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision c3b793637eab6ae0c12968c3c07f9993c1ef6f16) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java (.../McMonitoringStarterAction.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -54,6 +54,7 @@ import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -115,61 +116,25 @@ McGeneralAuthoringDTO mcGeneralAuthoringDTO= new McGeneralAuthoringDTO(); McGeneralMonitoringDTO mcGeneralMonitoringDTO=new McGeneralMonitoringDTO(); - ActionForward validateParameters=validateParameters(request, mapping, mcMonitoringForm); - logger.debug("validateParamaters: " + validateParameters); - - if (validateParameters != null) - { - //return validateParameters; - logger.debug("error validating monitoring parameters"); + String toolContentID = null; + try { + Long toolContentIDLong = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID, false); + toolContentID = toolContentIDLong.toString(); + mcMonitoringForm.setToolContentId(toolContentID); + mcMonitoringForm.setToolContentID(toolContentID); + } catch ( IllegalArgumentException e ) { + logger.error("Unable to start monitoring as tool content id is missing"); + McUtils.cleanUpSessionAbsolute(request); + throw (e); } - boolean initData=initialiseMonitoringData(mapping, form, request, response, + initialiseMonitoringData(mapping, form, request, response, mcService, mcGeneralMonitoringDTO); - logger.debug("initData: " + initData); - if (initData == false) - //return (mapping.findForward(ERROR_LIST)); - logger.debug("error initialising monitoring parameters"); mcMonitoringForm.setCurrentTab("1"); mcGeneralMonitoringDTO.setCurrentTab("1"); logger.debug("setting current tab to 1: "); - String toolContentID=mcMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - mcGeneralMonitoringDTO.setCountAllUsers(new Integer(0).toString()); - mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(0).toString()); - - McMonitoringAction mcMonitoringAction= new McMonitoringAction(); - - logger.debug("calling initSummaryContent."); - mcMonitoringAction.initSummaryContent(toolContentID , request, mcService, mcGeneralMonitoringDTO); - logger.debug("post initSummaryContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - logger.debug("post initInstructionsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - mcMonitoringAction.initStatsContent(toolContentID, request, mcService, mcGeneralMonitoringDTO); - logger.debug("post initStatsContent, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); - logger.debug("mcContent: " + mcContent); - - /*true means there is at least 1 response*/ - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - mcMonitoringForm.setActiveModule(MONITORING); mcGeneralMonitoringDTO.setActiveModule(MONITORING); @@ -179,26 +144,21 @@ mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); mcGeneralMonitoringDTO.setIsPortfolioExport(new Boolean(false).toString()); - logger.debug("calling submitSession:" + toolContentID); - request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); - /*this section is needed for Edit Activity screen, from here... */ - logger.debug("for copy using mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); mcGeneralAuthoringDTO.setActivityTitle(mcGeneralMonitoringDTO.getActivityTitle()); mcGeneralAuthoringDTO.setActivityInstructions(mcGeneralMonitoringDTO.getActivityInstructions()); mcGeneralAuthoringDTO.setActiveModule(MONITORING); - Map mapOptionsContent=mcGeneralMonitoringDTO.getMapOptionsContent(); - logger.debug("mapOptionsContent: " + mapOptionsContent); - int maxIndex=mapOptionsContent.size(); - logger.debug("maxIndex: " + maxIndex); - - logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); - request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - /*...till here */ + if ( logger.isDebugEnabled() ) { + logger.debug("mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); + logger.debug("mcGeneralAuthoringDTO: " + mcGeneralAuthoringDTO); + } + + request.setAttribute(MC_GENERAL_MONITORING_DTO, mcGeneralMonitoringDTO); + request.setAttribute(MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); logger.debug("calling submitSession with selectedToolSessionId" + mcMonitoringForm.getSelectedToolSessionId()); - return mcMonitoringAction.submitSession(mapping, mcMonitoringForm, request, response, mcService, mcGeneralMonitoringDTO); + return new McMonitoringAction().commonSubmitSessionCode(mcMonitoringForm, request, mapping, mcService, mcGeneralMonitoringDTO); } @@ -216,75 +176,29 @@ * @param mcGeneralMonitoringDTO * @return */ - public boolean initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, + public void initialiseMonitoringData(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, IMcService mcService, McGeneralMonitoringDTO mcGeneralMonitoringDTO) { logger.debug("start initializing monitoring data...mcService: " + mcService); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; - mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); - mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); - mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); - mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - - //McUtils.saveTimeZone(request); - - /* we have made sure TOOL_CONTENT_ID is passed */ String toolContentID=mcMonitoringForm.getToolContentID(); logger.debug("toolContentID: " + toolContentID); McContent mcContent=mcService.retrieveMc(new Long(toolContentID)); - logger.debug("existing mcContent:" + mcContent); - - if (mcContent == null) - { - McUtils.cleanUpSessionAbsolute(request); - mcGeneralMonitoringDTO.setUserExceptionContentDoesNotExist(new Boolean(true).toString()); - return false; - } - - - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - if (isContentInUse == true) - { - logger.debug("monitoring url does not allow editActivity since the content is in use."); - mcGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); - } - mcGeneralMonitoringDTO.setActivityTitle(mcContent.getTitle()); mcGeneralMonitoringDTO.setActivityInstructions(mcContent.getInstructions()); - logger.debug("checking student activity on the standard Questions:" + mcContent); - if (mcService.studentActivityOccurredGlobal(mcContent)) - { - McUtils.cleanUpSessionAbsolute(request); - logger.debug("student activity occurred on this content:" + mcContent); - mcGeneralMonitoringDTO.setUserExceptionContentInUse(new Boolean(true).toString()); - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - + mcGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); + mcGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setRequestLearningReport(new Boolean(false).toString()); + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + /* * get the questions * section is needed for the Edit tab's View Only mode, starts here */ - - SessionMap sessionMap = new SessionMap(); - sessionMap.put(ACTIVITY_TITLE_KEY, mcContent.getTitle()); - sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, mcContent.getInstructions()); - - mcMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); - request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - - List listQuestionContentDTO= new LinkedList(); Map mapOptionsContent= new TreeMap(new McComparator()); @@ -314,126 +228,35 @@ mcGeneralMonitoringDTO.setMapOptionsContent(mapOptionsContent); /* ends here*/ - logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); request.setAttribute(LIST_QUESTION_CONTENT_DTO,listQuestionContentDTO); - sessionMap.put(LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - request.setAttribute(TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - - McMonitoringAction mcMonitoringAction= new McMonitoringAction(); - logger.debug("refreshing summary data..."); - mcMonitoringAction.refreshSummaryData(request, mcContent, mcService, true, false, - null, null, false, null, mcGeneralMonitoringDTO, null); - logger.debug("post refreshSummaryData, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - //mcMonitoringAction.refreshStatsData(request, mcService, mcGeneralMonitoringDTO); - logger.debug("end initializing monitoring data..."); mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString()); logger.debug("post refreshes, mcGeneralMonitoringDTO: " + mcGeneralMonitoringDTO); - - - EditActivityDTO editActivityDTO = new EditActivityDTO(); - isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); - } - request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); - mcMonitoringAction.prepareReflectionData(request, mcContent, mcService, null, false, "All"); - - - boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(mcService, mcContent); - logger.debug("notebookEntriesExist : " + notebookEntriesExist); - - if (notebookEntriesExist) - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - - String userExceptionNoToolSessions=(String)mcGeneralMonitoringDTO.getUserExceptionNoToolSessions(); - logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); - - if (userExceptionNoToolSessions.equals("true")) - { - logger.debug("there are no online student activity but there are reflections : "); - request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); - } - - } - else - { - request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); - } - - /* SELECTION_CASE == 2 indicates start up */ request.setAttribute(SELECTION_CASE, new Long(2)); logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); - - + /* Default to All for tool Sessions so that all tool sessions' summary information gets displayed when the module starts up */ request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, "All"); MonitoringUtil.setupAllSessionsData(request, mcContent,mcService); - - /**getting instructions screen content from here... */ - mcGeneralMonitoringDTO.setOnlineInstructions(mcContent.getOnlineInstructions()); - mcGeneralMonitoringDTO.setOfflineInstructions(mcContent.getOfflineInstructions()); - - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); - logger.debug("attachmentList: " + attachmentList); - mcGeneralMonitoringDTO.setAttachmentList(attachmentList); - mcGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); - /** ...till here **/ - - MonitoringUtil.buildMcStatsDTO(request,mcService, mcContent); - - return true; + mcGeneralMonitoringDTO.setGroupName("All Groups"); + mcGeneralMonitoringDTO.setSelectionCase(new Long(2)); + mcGeneralMonitoringDTO.setCurrentMonitoredToolSession("All"); + mcGeneralMonitoringDTO.setListMonitoredAnswersContainerDto(new LinkedList()); + mcGeneralMonitoringDTO.setExistsOpenMcs(new Boolean(false).toString()); + + // The edit activity code needs a session map + SessionMap sessionMap = new SessionMap(); + mcMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); } /** - * ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, McMonitoringForm mcMonitoringForm) - * - * @param request - * @param mapping - * @param mcMonitoringForm - * @return - */ - protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, McMonitoringForm mcMonitoringForm) - { - logger.debug("start validating monitoring parameters..."); - - String strToolContentId=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); - logger.debug("strToolContentId: " + strToolContentId); - - if ((strToolContentId == null) || (strToolContentId.length() == 0)) - { - McUtils.cleanUpSessionAbsolute(request); - return (mapping.findForward(ERROR_LIST)); - } - else - { - try - { - long toolContentID=new Long(strToolContentId).longValue(); - logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentID)); - mcMonitoringForm.setToolContentID(strToolContentId); - } - catch(NumberFormatException e) - { - logger.debug("add error.numberFormatException"); - return (mapping.findForward(ERROR_LIST)); - } - } - return null; - } - - - /** * persists error messages to request scope * @param request * @param message Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== diff -u -r027758c2ee944683de01e4cd689fe3244d031920 -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision 027758c2ee944683de01e4cd689fe3244d031920) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java (.../McStarterAction.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -145,6 +145,7 @@ import org.lamsfoundation.lams.tool.mc.McGeneralAuthoringDTO; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; +import org.lamsfoundation.lams.tool.mc.pojos.McUploadedFile; import org.lamsfoundation.lams.tool.mc.service.IMcService; import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; import org.lamsfoundation.lams.util.WebUtil; @@ -461,7 +462,7 @@ mcGeneralAuthoringDTO.setReflectionSubject(mcContent.getReflectionSubject()); - List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); + List attachmentList = mcService.retrieveMcUploadedFiles(mcContent); mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(new ArrayList()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java =================================================================== diff -u -r51190e07e3d8dfaee600d9912e0a3d723363570a -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 51190e07e3d8dfaee600d9912e0a3d723363570a) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -37,13 +37,13 @@ import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.mc.McAllGroupsDTO; import org.lamsfoundation.lams.tool.mc.McAppConstants; +import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McGeneralMonitoringDTO; import org.lamsfoundation.lams.tool.mc.McMonitoredAnswersDTO; import org.lamsfoundation.lams.tool.mc.McMonitoredUserDTO; import org.lamsfoundation.lams.tool.mc.McSessionMarkDTO; -import org.lamsfoundation.lams.tool.mc.McStatsDTO; import org.lamsfoundation.lams.tool.mc.McStringComparator; import org.lamsfoundation.lams.tool.mc.McUserMarkDTO; -import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueContent; import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr; @@ -61,45 +61,7 @@ static Logger logger = Logger.getLogger(MonitoringUtil.class.getName()); /** - * - * populateToolSessions(HttpServletRequest request, McContent mcContent) * - * populates all the tool sessions in a map - * - * @param request - * @param mcContent - * @return Map - */ - public static Map populateToolSessions(HttpServletRequest request, McContent mcContent, IMcService mcService) - { - List sessionsList=mcService.getSessionNamesFromContent(mcContent); - logger.debug("sessionsList size is:..." + sessionsList.size()); - - Map sessionsMap=McUtils.convertToStringMap(sessionsList, "String"); - logger.debug("generated sessionsMap:..." + sessionsMap); - logger.debug("sessionsMap size:..." + sessionsMap.size()); - - if (sessionsMap.isEmpty()) - { - logger.debug("sessionsMap size is 0:"); - sessionsMap.put(new Long(1).toString() , "None"); - } - else - { - logger.debug("sessionsMap has some entries: " + sessionsMap.size()); - sessionsMap.put(new Long(sessionsMap.size()+ 1).toString() , "All"); - } - - logger.debug("final sessionsMap:" + sessionsMap); - return sessionsMap; - - - } - - - - /** - * * buildGroupsQuestionData(HttpServletRequest request, McContent mcContent) * * ends up populating the attempt history for all the users of all the tool sessions for a content @@ -309,41 +271,19 @@ logger.debug("will be building groups attempt data for mcQueContent:..." + mcQueContent + " questionUid:" + questionUid); Map mapMonitoredAttemptsContainerDTO= new TreeMap(new McStringComparator()); - Map summaryToolSessions=populateToolSessionsId(request, mcContent, mcService); - logger.debug("summaryToolSessions: " + summaryToolSessions); - - Iterator itMap = summaryToolSessions.entrySet().iterator(); - while (itMap.hasNext()) + Iterator sessionIterator = mcContent.getMcSessions().iterator(); + while (sessionIterator.hasNext()) { - Map.Entry pairs = (Map.Entry)itMap.next(); - logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); - - if (!(pairs.getValue().toString().equals("None")) && !(pairs.getValue().toString().equals("All"))) - { - logger.debug("using the numerical summary tool sessions pair: " + " = " + pairs.getValue()); - McSession mcSession= mcService.findMcSessionById(new Long(pairs.getValue().toString())); - logger.debug("mcSession: " + " = " + mcSession); - if (mcSession != null) - { - List listMcUsers=mcService.getMcUserBySessionOnly(mcSession); - logger.debug("listMcUsers for session id:" + mcSession.getMcSessionId() + " = " + listMcUsers); - List sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, mcService); - - // create a unique group name as the key for these attempts. This name will be shown on the output screen. - // the group name should be unique, so this a a "just in case" - String sessionName = mcSession.getSession_name(); - int extra = 1; - while ( mapMonitoredAttemptsContainerDTO.containsKey(sessionName) ) { - sessionName = sessionName + new Integer(extra).toString(); - extra++; - } - mapMonitoredAttemptsContainerDTO.put(sessionName, sessionUsersAttempts); - } - } + McSession mcSession = (McSession) sessionIterator.next(); + Set listMcUsers=mcSession.getMcQueUsers(); + List sessionUsersAttempts=populateSessionUsersAttempts(request,mcSession.getMcSessionId(), listMcUsers, questionUid, mcService); + mapMonitoredAttemptsContainerDTO.put(mcSession.getSession_name(), sessionUsersAttempts); } - - logger.debug("final mapMonitoredAttemptsContainerDTO:..." + mapMonitoredAttemptsContainerDTO); - return mapMonitoredAttemptsContainerDTO; + + if ( logger.isDebugEnabled() ) + logger.debug("final mapMonitoredAttemptsContainerDTO:..." + mapMonitoredAttemptsContainerDTO); + + return mapMonitoredAttemptsContainerDTO; } /** @@ -358,23 +298,20 @@ * @param listMcUsers * @return List */ - public static List populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, List listMcUsers, Long questionUid, IMcService mcService) + public static List populateSessionUsersAttempts(HttpServletRequest request,Long sessionId, Set listMcUsers, Long questionUid, IMcService mcService) { - logger.debug("starting populateSessionUsersAttempts"); - logger.debug("will be populating users marks for session id: " + sessionId); + if ( logger.isDebugEnabled() ) { + logger.debug("starting populateSessionUsersAttempts"); + logger.debug("will be populating users marks for session id: " + sessionId); + } McSession mcSession=mcService.retrieveMcSession(sessionId); - logger.debug("retrieving mcSession: " + mcSession); List listMonitoredUserContainerDTO= new LinkedList(); - - logger.debug("generating standard summary page"); Iterator itUsers=listMcUsers.iterator(); while (itUsers.hasNext()) { McQueUsr mcQueUsr=(McQueUsr)itUsers.next(); - logger.debug("current User is: " + mcQueUsr); - logger.debug("request is standard summary page."); listMonitoredUserContainerDTO=getAttemptEntries(request, mcService, mcQueUsr, mcSession, questionUid, listMonitoredUserContainerDTO, true); } @@ -450,112 +387,15 @@ return listMonitoredUserContainerDTO; } - /** - * McUsrAttempt getAttemptWithHighestOrder(List listUserAttempts) - * - * @param listUserAttempts - * @return - */ - public static McUsrAttempt getAttemptWithHighestOrder(List listUserAttempts) - { - logger.debug("starting getAttemptWithHighestOrder: " + listUserAttempts); - Iterator itAttempts=listUserAttempts.iterator(); - int highestOrder=0; - McUsrAttempt mcHighestUsrAttempt=null; - - while (itAttempts.hasNext()) - { - McUsrAttempt mcUsrAttempt=(McUsrAttempt)itAttempts.next(); - logger.debug("mcUsrAttempt: " + mcUsrAttempt); - int currentOrder=mcUsrAttempt.getAttemptOrder().intValue(); - logger.debug("currentOrder: " + currentOrder); - - if (currentOrder > highestOrder) - { - mcHighestUsrAttempt=mcUsrAttempt; - highestOrder=currentOrder; - logger.debug("highestOrder is updated to: " + highestOrder); - } - } - - logger.debug("returning mcHighestUsrAttempt: " + mcHighestUsrAttempt); - logger.debug("highestOrder has become: " + highestOrder); - return mcHighestUsrAttempt; - } - - - /** - * Map populateToolSessionsId(HttpServletRequest request, McContent mcContent, IMcService mcService) - * * @param request - * @param mcContent * @param mcService - * @return - */ - public static Map populateToolSessionsId(HttpServletRequest request, McContent mcContent, IMcService mcService) - { - List sessionsList=mcService.getSessionsFromContent(mcContent); - logger.debug("sessionsList size is:..." + sessionsList.size()); - - Map sessionsMap=McUtils.convertToStringMap(sessionsList, "Long"); - logger.debug("generated sessionsMap:..." + sessionsMap); - logger.debug("sessionsMap size:..." + sessionsMap.size()); - - if (sessionsMap.isEmpty()) - { - logger.debug("sessionsMap size is 0:"); - sessionsMap.put(new Long(1).toString() , "None"); - } - else - { - logger.debug("sessionsMap has some entries: " + sessionsMap.size()); - sessionsMap.put(new Long(sessionsMap.size()+ 1).toString() , "All"); - } - - logger.debug("final sessionsMap:" + sessionsMap); - return sessionsMap; - } - - - /** - * Map convertToMap(List list) - * - * @param list - * @return - */ - public static Map convertToMap(List list) - { - logger.debug("using convertToMap: " + list); - Map map= new TreeMap(new McStringComparator()); - - Iterator listIterator=list.iterator(); - Long mapIndex=new Long(1); - - while (listIterator.hasNext()) - { - Map data=(Map)listIterator.next(); - map.put(mapIndex.toString(), data); - mapIndex=new Long(mapIndex.longValue()+1); - } - return map; - } - - /** - * void buildMcStatsDTO(HttpServletRequest request, IMcService mcService, McContent mcContent) - * - * @param request - * @param mcService * @param mcContent */ - public static void buildMcStatsDTO(HttpServletRequest request, IMcService mcService, McContent mcContent) + public static void setSessionUserCount(McContent mcContent, McGeneralMonitoringDTO mcGeneralMonitoringDTO) { - logger.debug("building mcStatsDTO: " + mcContent); - McStatsDTO mcStatsDTO= new McStatsDTO(); - int countSessionComplete=0; int countAllUsers=0; - logger.debug("finding out about content level notebook entries: " + mcContent); Iterator iteratorSession= mcContent.getMcSessions().iterator(); while (iteratorSession.hasNext()) { @@ -568,33 +408,17 @@ if (mcSession.getSessionStatus().equals(COMPLETED)) { - ++countSessionComplete; + countSessionComplete++; } - - Iterator iteratorUser=mcSession.getMcQueUsers().iterator(); - while (iteratorUser.hasNext()) - { - McQueUsr mcQueUsr=(McQueUsr) iteratorUser.next(); - logger.debug("mcQueUsr: " + mcQueUsr); - - if (mcQueUsr != null) - { - logger.debug("mcQueUsr foundid"); - ++countAllUsers; - } - } + countAllUsers += mcSession.getMcQueUsers().size(); } } - logger.debug("countAllUsers: " + countAllUsers); - logger.debug("countSessionComplete: " + countSessionComplete); + mcGeneralMonitoringDTO.setCountAllUsers(new Integer(countAllUsers)); + mcGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete)); - mcStatsDTO.setCountAllUsers(new Integer(countAllUsers).toString()); - mcStatsDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); - - logger.debug("mcStatsDTO: " + mcStatsDTO); - - request.setAttribute(MC_STATS_DTO, mcStatsDTO); + if ( countSessionComplete > 0 ) + mcGeneralMonitoringDTO.setUserExceptionNoToolSessions(Boolean.FALSE.toString()); } Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestMcQueUsr.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -rdea5004371152a95bec9fc2db87a455fa84c0887 --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestMcQueUsr.java (.../TestMcQueUsr.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestMcQueUsr.java (.../TestMcQueUsr.java) (revision dea5004371152a95bec9fc2db87a455fa84c0887) @@ -82,9 +82,4 @@ } - public void testRemoveMcUserById() - { - mcUserDAO.removeMcUserById(TEST_NEW_USER_ID); - } - }