Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/ExportPortfolioDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/Attic/ExportPortfolioDTO.java,v
diff -u -r1.5 -r1.6
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/ExportPortfolioDTO.java 23 May 2008 06:05:24 -0000 1.5
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/ExportPortfolioDTO.java 6 Feb 2014 22:07:15 -0000 1.6
@@ -27,161 +27,173 @@
import org.apache.commons.lang.builder.ToStringBuilder;
-
-
/**
- *
DTO that holds export portfolio properties
+ *
+ * DTO that holds export portfolio properties
*
*
* @author Ozgur Demirtas
*/
-public class ExportPortfolioDTO implements Comparable
-{
+public class ExportPortfolioDTO implements Comparable {
protected String portfolioExportMode;
protected String userExceptionNoToolSessions;
protected String showResults;
-
+
protected Map mapStandardNominationsHTMLedContent;
protected Map mapStandardNominationsContent;
protected Map mapStandardUserCount;
protected Map mapStandardRatesContent;
-
+
protected List listUserEntries;
protected List listMonitoredAnswersContainerDto;
-
+
protected boolean allowText;
-
- public int compareTo(Object o)
- {
- VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = (VoteGeneralAuthoringDTO) o;
-
- if (voteGeneralAuthoringDTO == null)
- return 1;
- else
- return 0;
+
+ public int compareTo(Object o) {
+ VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = (VoteGeneralAuthoringDTO) o;
+
+ if (voteGeneralAuthoringDTO == null)
+ return 1;
+ else
+ return 0;
}
- public String toString() {
- return new ToStringBuilder(this)
- .append("portfolioExportMode: ", portfolioExportMode)
- .append("userExceptionNoToolSessions: ", userExceptionNoToolSessions)
- .append("mapStandardNominationsHTMLedContent: ", mapStandardNominationsHTMLedContent)
- .append("mapStandardUserCount: ", mapStandardUserCount)
- .append("mapStandardRatesContent: ", mapStandardRatesContent)
- .append("listUserEntries: ", listUserEntries)
- .append("listMonitoredAnswersContainerDto: ", listMonitoredAnswersContainerDto)
- .toString();
+ public String toString() {
+ return new ToStringBuilder(this).append("portfolioExportMode: ", portfolioExportMode)
+ .append("userExceptionNoToolSessions: ", userExceptionNoToolSessions)
+ .append("mapStandardNominationsHTMLedContent: ", mapStandardNominationsHTMLedContent)
+ .append("mapStandardUserCount: ", mapStandardUserCount)
+ .append("mapStandardRatesContent: ", mapStandardRatesContent)
+ .append("listUserEntries: ", listUserEntries)
+ .append("listMonitoredAnswersContainerDto: ", listMonitoredAnswersContainerDto).toString();
}
-
+
/**
* @return Returns the listMonitoredAnswersContainerDto.
*/
public List getListMonitoredAnswersContainerDto() {
- return listMonitoredAnswersContainerDto;
+ return listMonitoredAnswersContainerDto;
}
+
/**
- * @param listMonitoredAnswersContainerDto The listMonitoredAnswersContainerDto to set.
+ * @param listMonitoredAnswersContainerDto
+ * The listMonitoredAnswersContainerDto to set.
*/
- public void setListMonitoredAnswersContainerDto(
- List listMonitoredAnswersContainerDto) {
- this.listMonitoredAnswersContainerDto = listMonitoredAnswersContainerDto;
+ public void setListMonitoredAnswersContainerDto(List listMonitoredAnswersContainerDto) {
+ this.listMonitoredAnswersContainerDto = listMonitoredAnswersContainerDto;
}
+
/**
* @return Returns the listUserEntries.
*/
public List getListUserEntries() {
- return listUserEntries;
+ return listUserEntries;
}
+
/**
- * @param listUserEntries The listUserEntries to set.
+ * @param listUserEntries
+ * The listUserEntries to set.
*/
public void setListUserEntries(List listUserEntries) {
- this.listUserEntries = listUserEntries;
+ this.listUserEntries = listUserEntries;
}
+
/**
* @return Returns the mapStandardNominationsHTMLedContent.
*/
public Map getMapStandardNominationsHTMLedContent() {
- return mapStandardNominationsHTMLedContent;
+ return mapStandardNominationsHTMLedContent;
}
+
/**
- * @param mapStandardNominationsHTMLedContent The mapStandardNominationsHTMLedContent to set.
+ * @param mapStandardNominationsHTMLedContent
+ * The mapStandardNominationsHTMLedContent to set.
*/
- public void setMapStandardNominationsHTMLedContent(
- Map mapStandardNominationsHTMLedContent) {
- this.mapStandardNominationsHTMLedContent = mapStandardNominationsHTMLedContent;
+ public void setMapStandardNominationsHTMLedContent(Map mapStandardNominationsHTMLedContent) {
+ this.mapStandardNominationsHTMLedContent = mapStandardNominationsHTMLedContent;
}
+
/**
* @return Returns the mapStandardRatesContent.
*/
public Map getMapStandardRatesContent() {
- return mapStandardRatesContent;
+ return mapStandardRatesContent;
}
+
/**
- * @param mapStandardRatesContent The mapStandardRatesContent to set.
+ * @param mapStandardRatesContent
+ * The mapStandardRatesContent to set.
*/
public void setMapStandardRatesContent(Map mapStandardRatesContent) {
- this.mapStandardRatesContent = mapStandardRatesContent;
+ this.mapStandardRatesContent = mapStandardRatesContent;
}
+
/**
* @return Returns the mapStandardUserCount.
*/
public Map getMapStandardUserCount() {
- return mapStandardUserCount;
+ return mapStandardUserCount;
}
+
/**
- * @param mapStandardUserCount The mapStandardUserCount to set.
+ * @param mapStandardUserCount
+ * The mapStandardUserCount to set.
*/
public void setMapStandardUserCount(Map mapStandardUserCount) {
- this.mapStandardUserCount = mapStandardUserCount;
+ this.mapStandardUserCount = mapStandardUserCount;
}
+
/**
* @return Returns the portfolioExportMode.
*/
public String getPortfolioExportMode() {
- return portfolioExportMode;
+ return portfolioExportMode;
}
+
/**
- * @param portfolioExportMode The portfolioExportMode to set.
+ * @param portfolioExportMode
+ * The portfolioExportMode to set.
*/
public void setPortfolioExportMode(String portfolioExportMode) {
- this.portfolioExportMode = portfolioExportMode;
+ this.portfolioExportMode = portfolioExportMode;
}
+
/**
* @return Returns the userExceptionNoToolSessions.
*/
public String getUserExceptionNoToolSessions() {
- return userExceptionNoToolSessions;
+ return userExceptionNoToolSessions;
}
+
/**
- * @param userExceptionNoToolSessions The userExceptionNoToolSessions to set.
+ * @param userExceptionNoToolSessions
+ * The userExceptionNoToolSessions to set.
*/
- public void setUserExceptionNoToolSessions(
- String userExceptionNoToolSessions) {
- this.userExceptionNoToolSessions = userExceptionNoToolSessions;
+ public void setUserExceptionNoToolSessions(String userExceptionNoToolSessions) {
+ this.userExceptionNoToolSessions = userExceptionNoToolSessions;
}
- public Map getMapStandardNominationsContent() {
- return mapStandardNominationsContent;
- }
+ public Map getMapStandardNominationsContent() {
+ return mapStandardNominationsContent;
+ }
- public void setMapStandardNominationsContent(Map mapStandardNominationsContent) {
- this.mapStandardNominationsContent = mapStandardNominationsContent;
- }
+ public void setMapStandardNominationsContent(Map mapStandardNominationsContent) {
+ this.mapStandardNominationsContent = mapStandardNominationsContent;
+ }
- public String getShowResults() {
- return showResults;
- }
+ public String getShowResults() {
+ return showResults;
+ }
- public void setShowResults(String showResults) {
- this.showResults = showResults;
- }
+ public void setShowResults(String showResults) {
+ this.showResults = showResults;
+ }
- public boolean isAllowText() {
- return allowText;
- }
+ public boolean isAllowText() {
+ return allowText;
+ }
- public void setAllowText(boolean allowText) {
- this.allowText = allowText;
- }
+ public void setAllowText(boolean allowText) {
+ this.allowText = allowText;
+ }
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java,v
diff -u -r1.29 -r1.30
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 28 Jan 2014 23:05:52 -0000 1.29
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java 6 Feb 2014 22:07:15 -0000 1.30
@@ -41,18 +41,14 @@
List getAttemptsForUser(final Long queUsrId);
- List getUserRecords(final String userEntry);
+ List getUserRecords(final Long voteContentUid, final String userEntry);
- Set getUserEntries();
+ Set getUserEntries(final Long voteContentUid);
int getUserEnteredVotesCountForContent(final Long voteContentUid);
- List getSessionUserEntries(final Long voteSessionUid);
+ Set getSessionUserEntriesSet(final Long voteSessionUid);
- Set getSessionUserEntriesSet(final Long voteSessionUid);
-
- List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid);
-
VoteUsrAttempt getAttemptByUID(Long uid);
int getSessionEntriesCount(final Long voteSessionId);
@@ -63,21 +59,21 @@
int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid);
- List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
final Long voteSessionUid);
- void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId);
+ void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid);
- VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId,
- final Long voteQueContentId, final Long voteSessionId);
+ VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId,
+ final Long sessionUid);
void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt);
void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt);
- Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid);
+ Set getAttemptsForUserAndSession(final Long queUsrId, final Long sessionUid);
- Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId);
+ Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long sessionUid);
List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId);
}
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java,v
diff -u -r1.8 -r1.9
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java 23 Jan 2014 23:53:16 -0000 1.8
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteSessionDAO.java 6 Feb 2014 22:07:15 -0000 1.9
@@ -56,8 +56,8 @@
private static final String GET_SESSIONNAMES_FROM_CONTENT = "select votes.session_name from VoteSession votes where votes.voteContent=:voteContent order by votes.voteSessionId";
- public VoteSession getVoteSessionByUID(Long uid) {
- return (VoteSession) this.getHibernateTemplate().get(VoteSession.class, uid);
+ public VoteSession getVoteSessionByUID(Long sessionUid) {
+ return (VoteSession) this.getHibernateTemplate().get(VoteSession.class, sessionUid);
}
public VoteSession findVoteSessionById(Long voteSessionId) {
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.37 -r1.38
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 28 Jan 2014 23:05:51 -0000 1.37
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 6 Feb 2014 22:07:15 -0000 1.38
@@ -30,82 +30,85 @@
import org.hibernate.FlushMode;
import org.lamsfoundation.lams.tool.vote.dao.IVoteUsrAttemptDAO;
-import org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr;
import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt;
-import org.lamsfoundation.lams.tool.vote.service.IVoteService;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
+ * Hibernate implementation for database access to VoteUsrAttemptDAO for the voting tool.
+ *
* @author Ozgur Demirtas repaired by lfoxton
- *
- * Hibernate implementation for database access to VoteUsrAttemptDAO for the voting tool.
- *
*/
public class VoteUsrAttemptDAO extends HibernateDaoSupport implements IVoteUsrAttemptDAO {
private static final String LOAD_ATTEMPT_FOR_USER = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId";
private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.voteQueContentId=:voteQueContentId";
+ private static final String LOAD_ATTEMPT_FOR_QUESTION_CONTENT_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.voteQueContentId=:voteQueContentId and voteUsrAttempt.voteQueUsr.voteSession.uid=:sessionUid";
+
private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId";
- private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId";
+ private static final String LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueContentId=:voteQueContentId and voteUsrAttempt.voteQueUsr.voteSession.uid=:sessionUid";
- private static final String LOAD_ATTEMPT_FOR_USER_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId";
+ private static final String LOAD_ATTEMPT_FOR_USER_AND_SESSION = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueUsr.voteSession.uid=:sessionUid";
- private static final String LOAD_USER_ENTRIES = "select distinct voteUsrAttempt.userEntry from VoteUsrAttempt voteUsrAttempt";
+ private static final String LOAD_USER_ENTRIES = "select distinct voteUsrAttempt.userEntry from VoteUsrAttempt voteUsrAttempt where voteUsrAttempt.voteQueUsr.voteSession.voteContent.uid=:voteContentUid";
- private static final String LOAD_USER_ENTRY_RECORDS = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.userEntry=:userEntry and voteUsrAttempt.voteQueContentId=1 ";
+ private static final String LOAD_USER_ENTRY_RECORDS = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.userEntry=:userEntry and voteUsrAttempt.voteQueContentId=1 and voteUsrAttempt.voteQueUsr.voteSession.voteContent.uid=:voteContentUid";
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 "
+ private static final String LOAD_ENTRIES_BY_SESSION_UID = "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";
+ @Override
public VoteUsrAttempt getAttemptByUID(Long uid) {
String query = "from VoteUsrAttempt attempt where attempt.uid=?";
- List list = getSession().createQuery(query).setLong(0, uid.longValue()).list();
+ List list = getSession().createQuery(query).setLong(0, uid.longValue()).list();
- if (list != null && list.size() > 0) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) list.get(0);
+ if ((list != null) && (list.size() > 0)) {
+ VoteUsrAttempt attempt = list.get(0);
return attempt;
}
return null;
}
+ @Override
public void saveVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) {
this.getHibernateTemplate().save(voteUsrAttempt);
}
+ @Override
public List getAttemptsForUser(final Long queUsrId) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.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;
}
+ @Override
public int getUserEnteredVotesCountForContent(final Long voteContentUid) {
- List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ATTEMPTS_BY_CONTENT_ID).setLong("voteContentId",
- voteContentUid).list();
+ 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() {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRIES).list();
+ @Override
+ public Set getUserEntries(final Long voteContentUid) {
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRIES)
+ .setLong("voteContentUid", voteContentUid).list();
- Set set = new HashSet();
-
- Set userEntries = new HashSet();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
+ Set userEntries = new HashSet();
+ if ((list != null) && (list.size() > 0)) {
+ Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
- String entry = (String) listIterator.next();
+ String entry = listIterator.next();
if (entry != null && entry.length() > 0) {
userEntries.add(entry);
}
@@ -114,166 +117,149 @@
return userEntries;
}
- public List getSessionUserEntries(final Long voteSessionUid) {
-
- return getSession().createQuery(VoteUsrAttemptDAO.LOAD_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid",
- voteSessionUid).list();
+ @Override
+ public List getUserRecords(final Long voteContentUid, final String userEntry) {
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS)
+ .setLong("voteContentUid", voteContentUid).setString("userEntry", userEntry).list();
+ return list;
}
- public Set getSessionUserEntriesSet(final Long voteSessionUid) {
- List list = getSessionUserEntries(voteSessionUid);
+ @Override
+ public Set getSessionUserEntriesSet(final Long voteSessionUid) {
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ENTRIES_BY_SESSION_UID)
+ .setLong("voteSessionUid", voteSessionUid).list();
+
Set sessionUserEntries = new HashSet();
- for (VoteUsrAttempt att : list) {
- sessionUserEntries.add(att);
- }
+ sessionUserEntries.addAll(list);
return sessionUserEntries;
}
- public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId) {
- String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId";
+ @Override
+ public void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid) {
+ String strGetUser = "from voteUsrAttempt in class VoteUsrAttempt where voteUsrAttempt.queUsrId=:queUsrId and voteUsrAttempt.voteQueUsr.voteSession.uid=:sessionUid";
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(strGetUser).setLong("queUsrId", queUsrId.longValue()).list();
+ List list = getSession().createQuery(strGetUser).setLong("queUsrId", queUsrId.longValue())
+ .setLong("sessionUid", sessionUid).list();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
+ if ((list != null) && (list.size() > 0)) {
+ Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) {
- this.getSession().setFlushMode(FlushMode.AUTO);
- templ.delete(attempt);
- templ.flush();
-
- }
+ VoteUsrAttempt attempt = listIterator.next();
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(attempt);
+ templ.flush();
}
}
}
+ @Override
public int getAttemptsForQuestionContent(final Long voteQueContentId) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.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) {
+ if ((list != null) && (list.size() > 0)) {
return list.size();
}
return 0;
}
- public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) {
- 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) {
- Iterator listIterator = list.iterator();
- while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
- userEntries.add(attempt);
- }
- }
- }
- return userEntries.size();
-
+ @Override
+ public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long sessionUid) {
+ List list = getStandardAttemptUsersForQuestionContentAndSessionUid(voteQueContentId, sessionUid);
+ return list.size();
}
- public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
- final Long voteSessionUid) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong(
- "voteQueContentId", voteQueContentId.longValue()).list();
+ @Override
+ public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ final Long sessionUid) {
+ List list = getSession()
+ .createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT_AND_SESSION)
+ .setLong("voteQueContentId", voteQueContentId.longValue())
+ .setLong("sessionUid", sessionUid.longValue()).list();
- List userEntries = new ArrayList();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
- while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
- userEntries.add(attempt);
- }
- }
+ List userEntries = new ArrayList();
+ if ((list != null) && (list.size() > 0)) {
+ userEntries.addAll(list);
}
return userEntries;
}
+ @Override
public List getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.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();
return list;
}
+ @Override
public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.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;
}
+ @Override
public VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId,
- final Long voteQueContentId, final Long voteSessionUid) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION)
+ final Long voteQueContentId, final Long sessionUid) {
+ List list = getSession()
+ .createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION)
.setLong("queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue())
- .list();
+ .setLong("sessionUid", sessionUid.longValue()).list();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
- while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
- return attempt;
- }
- }
+ if ((list == null) || (list.size() == 0)) {
+ return null;
}
- return null;
+ return list.get(0);
}
- public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid) {
+ @Override
+ public Set getAttemptsForUserAndSession(final Long queUsrId, final Long sessionUid) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
- queUsrId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION)
+ .setLong("queUsrId", queUsrId.longValue()).setLong("sessionUid", sessionUid.longValue()).list();
- Set userEntries = new HashSet();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
+ Set userEntries = new HashSet();
+ if ((list != null) && (list.size() > 0)) {
+ Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
+ VoteUsrAttempt attempt = listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
- Long questionUid = attempt.getVoteQueContent().getUid();
- if (!questionUid.toString().equals("1")) {
- userEntries.add(attempt.getVoteQueContent().getQuestion());
- }
+ Long questionUid = attempt.getVoteQueContent().getUid();
+ if (!questionUid.toString().equals("1")) {
+ userEntries.add(attempt.getVoteQueContent().getQuestion());
}
}
}
return userEntries;
}
- public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId) {
+ @Override
+ public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long sessionUid) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
- queUsrId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION)
+ .setLong("queUsrId", queUsrId.longValue()).setLong("sessionUid", sessionUid.longValue()).list();
String openAnswer = "";
- Set userEntries = new HashSet();
- if (list != null && list.size() > 0) {
- Iterator listIterator = list.iterator();
+ Set userEntries = new HashSet();
+ if ((list != null) && (list.size() > 0)) {
+ Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
- VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
+ VoteUsrAttempt attempt = listIterator.next();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) {
- Long questionUid = attempt.getVoteQueContent().getUid();
- if (!questionUid.toString().equals("1")) {
- userEntries.add(attempt.getVoteQueContent().getQuestion());
- } else {
- //this is a user entered vote
- if (attempt.getUserEntry().length() > 0) {
- openAnswer = attempt.getUserEntry();
- //adding openAnswer to userEntries
- userEntries.add(openAnswer);
- }
-
+ Long questionUid = attempt.getVoteQueContent().getUid();
+ if (!questionUid.toString().equals("1")) {
+ userEntries.add(attempt.getVoteQueContent().getQuestion());
+ } else {
+ // this is a user entered vote
+ if (attempt.getUserEntry().length() > 0) {
+ openAnswer = attempt.getUserEntry();
+ // adding openAnswer to userEntries
+ userEntries.add(openAnswer);
}
}
@@ -282,41 +268,21 @@
return userEntries;
}
- public List getUserRecords(final String userEntry) {
- List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry",
- userEntry).list();
- return list;
- }
-
- public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid) {
- 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();
- if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
- sessionUserEntries.add(attempt.getUserEntry());
- }
- }
- }
- return sessionUserEntries;
- }
-
+ @Override
public int getSessionEntriesCount(final Long voteSessionUid) {
- List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid",
- voteSessionUid).list();
+ List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ENTRIES_BY_SESSION_ID)
+ .setLong("voteSessionUid", voteSessionUid).list();
Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0);
return resultLong.intValue();
}
+ @Override
public void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) {
this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().update(voteUsrAttempt);
}
+ @Override
public void removeVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) {
this.getSession().setFlushMode(FlushMode.AUTO);
this.getHibernateTemplate().delete(voteUsrAttempt);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java,v
diff -u -r1.48 -r1.49
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 29 Jan 2014 20:20:41 -0000 1.48
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java 6 Feb 2014 22:07:15 -0000 1.49
@@ -98,7 +98,7 @@
*/
LinkedList getSessionDTOs(Long toolContentID);
- List processUserEnteredNominations(VoteContent voteContent, String currentSessionId,
+ List processUserEnteredNominations(Long voteContentUid, String currentSessionId,
boolean showUserEntriesBySession, String userId, boolean showUserEntriesByUserId);
List getReflectionData(VoteContent voteContent, Long userID);
@@ -115,8 +115,6 @@
void createVoteQueUsr(VoteQueUsr voteQueUsr) throws VoteApplicationException;
- List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid);
-
VoteQueUsr getVoteUserBySession(final Long queUsrId, final Long sessionUid)
throws VoteApplicationException;
@@ -129,16 +127,14 @@
VoteQueContent getQuestionContentByDisplayOrder(final Long displayOrder, final Long voteContentUid)
throws VoteApplicationException;
- Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid);
+ Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid);
Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException;
void createVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
void updateVoteUsrAttempt(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
- List getUserRecords(final String userEntry) throws VoteApplicationException;
-
List getUserBySessionOnly(final VoteSession voteSession) throws VoteApplicationException;
void hideOpenVote(VoteUsrAttempt voteUsrAttempt) throws VoteApplicationException;
@@ -153,7 +149,7 @@
int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException;
- List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
final Long voteSessionUid);
int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionId)
@@ -185,12 +181,8 @@
void cleanAllQuestions(final Long voteContentUid) throws VoteApplicationException;
- Set getUserEntries() throws VoteApplicationException;
-
List getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId);
- List getSessionUserEntries(final Long voteSessionId) throws VoteApplicationException;
-
VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid);
void removeVoteQueContentByUID(Long uid) throws VoteApplicationException;
@@ -199,7 +191,7 @@
void updateVoteUser(VoteQueUsr voteUser) throws VoteApplicationException;
- void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId)
+ void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid)
throws VoteApplicationException;
List getAllQuestionEntries(final Long voteContentId) throws VoteApplicationException;
@@ -286,7 +278,7 @@
List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException;
- Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid)
+ Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionUid)
throws VoteApplicationException;
Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java,v
diff -u -r1.78 -r1.79
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 2 Feb 2014 17:19:34 -0000 1.78
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java 6 Feb 2014 22:07:15 -0000 1.79
@@ -296,7 +296,7 @@
VoteContent voteContent = this.retrieveVote(toolContentID);
int entriesCount = 0;
- Set userEntries = null;
+ Set userEntries = null;
if (toolSessionUid != null) {
entriesCount = this.getSessionEntriesCount(toolSessionUid);
userEntries = this.getSessionUserEntriesSet(toolSessionUid);
@@ -428,7 +428,7 @@
sessionDTO.setMapStandardQuestionUid(mapStandardQuestionUid);
sessionDTO.setMapStandardToolSessionUid(mapStandardToolSessionUid);
- List openVotes = this.processUserEnteredNominations(voteContent, session
+ List openVotes = this.processUserEnteredNominations(voteContent.getUid(), session
.getVoteSessionId().toString(), true, null, false);
sessionDTO.setOpenVotes(openVotes);
boolean isExistsOpenVote = openVotes.size() > 0;
@@ -521,9 +521,9 @@
}
@Override
- public List processUserEnteredNominations(VoteContent voteContent,
- String currentSessionId, boolean showUserEntriesBySession, String userId, boolean showUserEntriesByUserId) {
- Set userEntries = this.getUserEntries();
+ public List processUserEnteredNominations(Long voteContentUid, String currentSessionId,
+ boolean showUserEntriesBySession, String userId, boolean showUserEntriesByUserId) {
+ Set userEntries = voteUsrAttemptDAO.getUserEntries(voteContentUid);
List listUserEntries = new LinkedList();
@@ -535,60 +535,34 @@
VoteMonitoredAnswersDTO voteMonitoredAnswersDTO = new VoteMonitoredAnswersDTO();
voteMonitoredAnswersDTO.setQuestion(userEntry);
- List userRecords = this.getUserRecords(userEntry);
+ List userRecords = voteUsrAttemptDAO.getUserRecords(voteContentUid, userEntry);
List listMonitoredUserContainerDTO = new LinkedList();
Iterator itUserRecords = userRecords.iterator();
while (itUserRecords.hasNext()) {
VoteMonitoredUserDTO voteMonitoredUserDTO = new VoteMonitoredUserDTO();
VoteUsrAttempt voteUsrAttempt = (VoteUsrAttempt) itUserRecords.next();
- VoteSession localUserSession = voteUsrAttempt.getVoteQueUsr().getVoteSession();
-
- if (showUserEntriesBySession == false) {
- if (voteContent.getUid().toString().equals(localUserSession.getVoteContentId().toString())) {
- voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime());
- voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
- voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname());
- voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
- voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
- voteMonitoredUserDTO.setUid(voteUsrAttempt.getUid().toString());
- voteMonitoredUserDTO.setVisible(new Boolean(voteUsrAttempt.isVisible()).toString());
- listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
- }
+ if (!showUserEntriesBySession) {
+ voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime());
+ voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
+ voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname());
+ voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
+ voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ voteMonitoredUserDTO.setUid(voteUsrAttempt.getUid().toString());
+ voteMonitoredUserDTO.setVisible(new Boolean(voteUsrAttempt.isVisible()).toString());
+ listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+
} else {
// showUserEntriesBySession is true: the case with learner export portfolio
- // show user entries by same content and same session and same user
+ // show user entries by same same session and same user
String userSessionId = voteUsrAttempt.getVoteQueUsr().getVoteSession().getVoteSessionId()
.toString();
- if (showUserEntriesByUserId == true) {
- if (voteContent.getUid().toString().equals(localUserSession.getVoteContentId().toString())) {
- if (userSessionId.equals(currentSessionId)) {
- String localUserId = voteUsrAttempt.getVoteQueUsr().getQueUsrId().toString();
- if (userId.equals(localUserId)) {
- voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime());
- voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
- voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname());
- voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid()
- .toString());
- voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
- listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
- voteMonitoredUserDTO.setUid(voteUsrAttempt.getUid().toString());
- voteMonitoredUserDTO.setVisible(new Boolean(voteUsrAttempt.isVisible())
- .toString());
- if (voteUsrAttempt.isVisible() == false) {
- voteMonitoredAnswersDTO.setQuestion("Nomination Hidden");
- }
-
- }
- }
- }
- } else {
- // showUserEntriesByUserId is false
- // show user entries by same content and same session
- if (voteContent.getUid().toString().equals(localUserSession.getVoteContentId().toString())) {
- if (userSessionId.equals(currentSessionId)) {
+ if (showUserEntriesByUserId) {
+ if (userSessionId.equals(currentSessionId)) {
+ String localUserId = voteUsrAttempt.getVoteQueUsr().getQueUsrId().toString();
+ if (userId.equals(localUserId)) {
voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime());
voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname());
@@ -598,8 +572,25 @@
listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
voteMonitoredUserDTO.setUid(voteUsrAttempt.getUid().toString());
voteMonitoredUserDTO.setVisible(new Boolean(voteUsrAttempt.isVisible()).toString());
+ if (voteUsrAttempt.isVisible() == false) {
+ voteMonitoredAnswersDTO.setQuestion("Nomination Hidden");
+ }
+
}
}
+ } else {
+ // showUserEntriesByUserId is false
+ // show user entries by same session
+ if (userSessionId.equals(currentSessionId)) {
+ voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime());
+ voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone());
+ voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname());
+ voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString());
+ voteMonitoredUserDTO.setUserEntry(voteUsrAttempt.getUserEntry());
+ listMonitoredUserContainerDTO.add(voteMonitoredUserDTO);
+ voteMonitoredUserDTO.setUid(voteUsrAttempt.getUid().toString());
+ voteMonitoredUserDTO.setVisible(new Boolean(voteUsrAttempt.isVisible()).toString());
+ }
}
}
@@ -738,7 +729,7 @@
}
}
- public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
+ public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
final Long voteSessionUid) {
try {
return voteUsrAttemptDAO.getStandardAttemptUsersForQuestionContentAndSessionUid(voteQueContentId,
@@ -749,17 +740,8 @@
}
}
- public Set getUserEntries() throws VoteApplicationException {
+ public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid) {
try {
- return voteUsrAttemptDAO.getUserEntries();
- } catch (DataAccessException e) {
- throw new VoteApplicationException(
- "Exception occured when lams is getting user entries: " + e.getMessage(), e);
- }
- }
-
- public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long userUid, final Long sessionUid) {
- try {
return voteUsrAttemptDAO.getAttemptsForUserAndSessionUseOpenAnswer(userUid, sessionUid);
} catch (DataAccessException e) {
throw new VoteApplicationException(
@@ -769,27 +751,18 @@
}
- public List getSessionUserEntries(final Long voteSessionUid) throws VoteApplicationException {
- try {
- return voteUsrAttemptDAO.getSessionUserEntries(voteSessionUid);
- } catch (DataAccessException e) {
- throw new VoteApplicationException("Exception occured when lams is getting session user entries: "
- + e.getMessage(), e);
- }
- }
-
- public Set getAttemptsForUserAndSession(final Long queUsrUid, final Long voteSessionUid)
+ public Set getAttemptsForUserAndSession(final Long queUsrUid, final Long sessionUid)
throws VoteApplicationException {
try {
- return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, voteSessionUid);
+ return voteUsrAttemptDAO.getAttemptsForUserAndSession(queUsrUid, sessionUid);
} catch (DataAccessException e) {
throw new VoteApplicationException("Exception occured when lams is getting user entries: "
+ e.getMessage(), e);
}
}
- public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException {
+ public Set getSessionUserEntriesSet(final Long voteSessionUid) throws VoteApplicationException {
try {
return voteUsrAttemptDAO.getSessionUserEntriesSet(voteSessionUid);
} catch (DataAccessException e) {
@@ -870,14 +843,14 @@
}
}
- public int getVoteSessionPotentialLearnersCount(Long voteSessionId) throws VoteApplicationException {
+ public int getVoteSessionPotentialLearnersCount(Long sessionUid) throws VoteApplicationException {
try {
- VoteSession session = voteSessionDAO.getVoteSessionByUID(voteSessionId);
+ VoteSession session = voteSessionDAO.getVoteSessionByUID(sessionUid);
if (session != null) {
- Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue());
+ Set potentialLearners = toolService.getAllPotentialLearners(session.getVoteSessionId().longValue());
return potentialLearners != null ? potentialLearners.size() : 0;
} else {
- VoteServicePOJO.logger.error("Unable to find vote session record id=" + voteSessionId
+ VoteServicePOJO.logger.error("Unable to find vote session record id=" + sessionUid
+ ". Returning 0 users.");
return 0;
}
@@ -994,15 +967,6 @@
}
}
- public List getUserRecords(final String userEntry) throws VoteApplicationException {
- try {
- return voteUsrAttemptDAO.getUserRecords(userEntry);
- } catch (DataAccessException e) {
- throw new VoteApplicationException("Exception occured when lams is getting user records for user entry: "
- + e.getMessage(), e);
- }
- }
-
public VoteUsrAttempt getAttemptForUserAndQuestionContentAndSession(final Long queUsrId,
final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException {
try {
@@ -1023,10 +987,10 @@
}
}
- public void removeAttemptsForUserandSession(final Long queUsrId, final Long voteSessionId)
+ public void removeAttemptsForUserandSession(final Long queUsrId, final Long sessionUid)
throws VoteApplicationException {
try {
- voteUsrAttemptDAO.removeAttemptsForUserandSession(queUsrId, voteSessionId);
+ voteUsrAttemptDAO.removeAttemptsForUserandSession(queUsrId, sessionUid);
} catch (DataAccessException e) {
throw new VoteApplicationException("Exception occured when lams is removing by user and votesession id : "
+ e.getMessage(), e);
@@ -1043,16 +1007,6 @@
}
- public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid) {
- try {
- return voteUsrAttemptDAO.getUserEnteredVotesForSession(userEntry, voteSessionUid);
- } catch (DataAccessException e) {
- throw new VoteApplicationException(
- "Exception occured when lams is getting user entered votes for session: " + e.getMessage(), e);
- }
-
- }
-
public int getUserEnteredVotesCountForContent(final Long voteContentUid) throws VoteApplicationException {
try {
return voteUsrAttemptDAO.getUserEnteredVotesCountForContent(voteContentUid);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java,v
diff -u -r1.31 -r1.32
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java 29 Jan 2014 20:20:41 -0000 1.31
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java 6 Feb 2014 22:07:15 -0000 1.32
@@ -47,13 +47,10 @@
import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet;
/**
- *
* Enables exporting portfolio for teacher and learner modes.
- *
*
* @author Ozgur Demirtas
*/
-
public class ExportServlet extends AbstractExportPortfolioServlet implements VoteAppConstants {
static Logger logger = Logger.getLogger(ExportServlet.class.getName());
private static final long serialVersionUID = -1529093489007108983L;
@@ -82,7 +79,6 @@
exportPortfolioDTO.setPortfolioExportMode("learner");
IVoteService voteService = VoteServiceProxy.getVoteService(getServletContext());
- MessageService messageService = VoteServiceProxy.getMessageService(getServletContext());
if ((userID == null) || (toolSessionID == null)) {
String error = "Tool session Id or user Id is null. Unable to continue";
@@ -111,8 +107,8 @@
VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO();
- VoteMonitoringStarterAction.refreshSummaryData(request, content, voteService, true, true,
- toolSessionID.toString(), userID.toString(), true, null, voteGeneralMonitoringDTO,
+ VoteMonitoringStarterAction.refreshSummaryData(request, content, voteService, true,
+ toolSessionID.toString(), userID.toString(), true, voteGeneralMonitoringDTO,
exportPortfolioDTO);
List reflectionsContainerDTO = voteService.getReflectionData(content, userID);
@@ -130,9 +126,7 @@
public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) {
ExportPortfolioDTO exportPortfolioDTO = new ExportPortfolioDTO();
exportPortfolioDTO.setPortfolioExportMode("teacher");
-
IVoteService voteService = VoteServiceProxy.getVoteService(getServletContext());
- MessageService messageService = VoteServiceProxy.getMessageService(getServletContext());
if (toolContentID == null) {
String error = "Tool Content Id is missing. Unable to continue";
@@ -141,7 +135,6 @@
}
VoteContent content = voteService.retrieveVote(toolContentID);
-
if (content == null) {
String error = "Data is missing from the database. Unable to Continue";
ExportServlet.logger.error(error);
@@ -152,7 +145,7 @@
VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO();
- VoteMonitoringStarterAction.refreshSummaryData(request, content, voteService, true, false, null, null, false, null,
+ VoteMonitoringStarterAction.refreshSummaryData(request, content, voteService, false, null, null, false,
voteGeneralMonitoringDTO, exportPortfolioDTO);
request.getSession().setAttribute(VoteAppConstants.EXPORT_PORTFOLIO_DTO, exportPortfolioDTO);
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java,v
diff -u -r1.55 -r1.56
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java 28 Jan 2014 23:05:51 -0000 1.55
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java 6 Feb 2014 22:07:15 -0000 1.56
@@ -72,285 +72,6 @@
*/
public class MonitoringUtil implements VoteAppConstants {
- /**
- * groups user's votes
- */
- public static Map buildGroupsAttemptData(HttpServletRequest request, VoteContent voteContent,
- VoteQueContent voteQueContent, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest,
- String currentSessionId, String userId, IVoteService voteService) {
-
- List