parentContextKey
Index: lams_tool_vote/.classpath
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/.classpath,v
diff -u -r1.4 -r1.4.8.1
--- lams_tool_vote/.classpath 30 Oct 2008 03:48:30 -0000 1.4
+++ lams_tool_vote/.classpath 13 May 2009 12:24:57 -0000 1.4.8.1
@@ -5,12 +5,15 @@
-
-
-
+
+
+
+
+
+
-
+
Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java,v
diff -u -r1.32 -r1.32.6.1
--- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 18 Feb 2009 23:06:58 -0000 1.32
+++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java 13 May 2009 12:24:57 -0000 1.32.6.1
@@ -41,8 +41,7 @@
/**
* @author Ozgur Demirtas repaired by lfoxton
*
- * Hibernate implementation for database access to VoteUsrAttemptDAO for
- * the voting tool.
+ * Hibernate implementation for database access to VoteUsrAttemptDAO for the voting tool.
*
*/
public class VoteUsrAttemptDAO extends HibernateDaoSupport implements IVoteUsrAttemptDAO {
@@ -70,20 +69,19 @@
// lfoxton about below:
// No! Very Bad programmer!!! Go to your room and think about what you did!
- //private static final String LOAD_ALL_ENTRIES = "from voteUsrAttempt in class VoteUsrAttempt";
+ // private static final String LOAD_ALL_ENTRIES = "from voteUsrAttempt in class VoteUsrAttempt";
private static final String LOAD_DISTINCT_USER_ENTRIES = "select distinct voteUsrAttempt.queUsrId from VoteUsrAttempt voteUsrAttempt";
private static final String COUNT_ATTEMPTS_BY_CONTENT_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where "
+ "att.voteQueUsr=user and user.voteSession=ses and " + "ses.voteContentId=:voteContentId";
-
+
private static final String LOAD_ENTRIES_BY_SESSION_ID = "select att from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where "
+ "att.voteQueUsr=user and user.voteSession=ses and ses.uid=:voteSessionUid";
-
+
private static final String COUNT_ENTRIES_BY_SESSION_ID = "select count(*) from VoteUsrAttempt att, VoteQueUsr user, VoteSession ses where "
+ "att.voteQueUsr=user and user.voteSession=ses and ses.uid=:voteSessionUid";
-
public VoteUsrAttempt getVoteUserAttemptByUID(Long uid) {
return (VoteUsrAttempt) this.getHibernateTemplate().get(VoteUsrAttempt.class, uid);
}
@@ -107,20 +105,21 @@
public List getAttemptsForUser(final Long queUsrId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", queUsrId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId",
+ queUsrId.longValue()).list();
return list;
}
public int getUserEnteredVotesCountForContent(final Long voteContentUid) {
- List result = getSession().createQuery(COUNT_ATTEMPTS_BY_CONTENT_ID).setLong("voteContentId", voteContentUid)
- .list();
- Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0);
- return resultInt.intValue();
+ List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ATTEMPTS_BY_CONTENT_ID).setLong("voteContentId",
+ voteContentUid).list();
+ Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0);
+ return resultLong.intValue();
}
public Set getUserEntries() {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_USER_ENTRIES).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRIES).list();
Set set = new HashSet();
@@ -129,32 +128,34 @@
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
String entry = (String) listIterator.next();
- logger.debug("entry: " + entry);
- if ((entry != null) && (entry.length() > 0))
+ VoteUsrAttemptDAO.logger.debug("entry: " + entry);
+ if (entry != null && entry.length() > 0) {
userEntries.add(entry);
+ }
}
}
return userEntries;
}
public List getSessionUserEntries(final Long voteSessionUid) {
-
- return getSession().createQuery(LOAD_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", voteSessionUid).list();
+
+ return getSession().createQuery(VoteUsrAttemptDAO.LOAD_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid",
+ voteSessionUid).list();
}
public Set getSessionUserEntriesSet(final Long voteSessionUid) {
- List list = (List)getSessionUserEntries(voteSessionUid);
+ List list = getSessionUserEntries(voteSessionUid);
Set sessionUserEntries = new HashSet();
- for (VoteUsrAttempt att : list)
- {
+ for (VoteUsrAttempt att : list) {
sessionUserEntries.add(att);
}
return sessionUserEntries;
}
public int getUserRecordsEntryCount(final String userEntry) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry",
+ userEntry).list();
if (list != null && list.size() > 0) {
return list.size();
@@ -166,18 +167,19 @@
public int getSessionUserRecordsEntryCount(final String userEntry, final Long voteSessionUid,
IVoteService voteService) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_DISTINCT_USER_ENTRY_RECORDS).setString("userEntry",
+ userEntry).list();
int entryCount = 0;
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
Long userId = (Long) listIterator.next();
- logger.debug("userId: " + userId);
- logger.debug("voteService: " + voteService);
+ VoteUsrAttemptDAO.logger.debug("userId: " + userId);
+ VoteUsrAttemptDAO.logger.debug("voteService: " + voteService);
VoteQueUsr voteQueUsr = voteService.getVoteUserByUID(userId);
- logger.debug("voteQueUsr: " + voteQueUsr);
+ VoteUsrAttemptDAO.logger.debug("voteQueUsr: " + voteQueUsr);
if (voteQueUsr.getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
++entryCount;
@@ -189,7 +191,8 @@
public void removeAttemptsForUser(final Long queUsrId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER).setLong("queUsrId", queUsrId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER).setLong("queUsrId",
+ queUsrId.longValue()).list();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
@@ -223,8 +226,8 @@
public int getAttemptsForQuestionContent(final Long voteQueContentId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId",
- voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong(
+ "voteQueContentId", voteQueContentId.longValue()).list();
if (list != null && list.size() > 0) {
return list.size();
@@ -235,8 +238,8 @@
public int getStandardAttemptsForQuestionContentAndSessionUid(final Long voteQueContentId, final Long voteSessionUid) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId",
- voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong(
+ "voteQueContentId", voteQueContentId.longValue()).list();
List userEntries = new ArrayList();
if (list != null && list.size() > 0) {
@@ -255,8 +258,8 @@
public List getStandardAttemptUsersForQuestionContentAndSessionUid(final Long voteQueContentId,
final Long voteSessionUid) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId",
- voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong(
+ "voteQueContentId", voteQueContentId.longValue()).list();
List userEntries = new ArrayList();
if (list != null && list.size() > 0) {
@@ -274,19 +277,21 @@
public boolean isVoteVisibleForSession(final String userEntry, final Long voteSessionUid) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry",
+ userEntry).list();
List sessionUserEntries = new ArrayList();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- logger.debug("attempt: " + attempt);
+ VoteUsrAttemptDAO.logger.debug("attempt: " + attempt);
if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
boolean isVoteVisible = attempt.isVisible();
- logger.debug("isVoteVisible: " + isVoteVisible);
- if (isVoteVisible == false)
+ VoteUsrAttemptDAO.logger.debug("isVoteVisible: " + isVoteVisible);
+ if (isVoteVisible == false) {
return false;
+ }
}
}
}
@@ -296,8 +301,8 @@
public int getStandardAttemptsForQuestionContentAndContentUid(final Long voteQueContentId, final Long voteContentUid) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong("voteQueContentId",
- voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUESTION_CONTENT).setLong(
+ "voteQueContentId", voteQueContentId.longValue()).list();
List userEntries = new ArrayList();
if (list != null && list.size() > 0) {
@@ -317,23 +322,24 @@
public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId",
- queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong(
+ "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
return list;
}
public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId,
final Long voteQueContentId, final Long voteSessionId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION).setLong(
- "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT_AND_SESSION)
+ .setLong("queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue())
+ .list();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- logger.debug("attempt: " + attempt);
+ VoteUsrAttemptDAO.logger.debug("attempt: " + attempt);
if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) {
return attempt;
}
@@ -343,61 +349,63 @@
}
public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) {
- logger.debug("starting getAttemptsForUserAndSession");
- logger.debug("queUsrId: " + queUsrId);
- logger.debug("voteSessionId: " + voteSessionId);
+ VoteUsrAttemptDAO.logger.debug("starting getAttemptsForUserAndSession");
+ VoteUsrAttemptDAO.logger.debug("queUsrId: " + queUsrId);
+ VoteUsrAttemptDAO.logger.debug("voteSessionId: " + voteSessionId);
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
queUsrId.longValue()).list();
- logger.debug("list: " + list);
+ VoteUsrAttemptDAO.logger.debug("list: " + list);
Set userEntries = new HashSet();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- logger.debug("attempt: " + attempt);
+ VoteUsrAttemptDAO.logger.debug("attempt: " + attempt);
if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) {
if (!attempt.getVoteQueContentId().toString().equals("1")) {
- logger.debug("adding attempt question : " + attempt.getVoteQueContent().getQuestion());
+ VoteUsrAttemptDAO.logger.debug("adding attempt question : "
+ + attempt.getVoteQueContent().getQuestion());
userEntries.add(attempt.getVoteQueContent().getQuestion());
}
}
}
}
- logger.debug("returning userEntries: " + userEntries);
+ VoteUsrAttemptDAO.logger.debug("returning userEntries: " + userEntries);
return userEntries;
}
public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId) {
- logger.debug("starting getAttemptsForUserAndSession");
- logger.debug("queUsrId: " + queUsrId);
- logger.debug("voteSessionId: " + voteSessionId);
+ VoteUsrAttemptDAO.logger.debug("starting getAttemptsForUserAndSession");
+ VoteUsrAttemptDAO.logger.debug("queUsrId: " + queUsrId);
+ VoteUsrAttemptDAO.logger.debug("voteSessionId: " + voteSessionId);
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_SESSION).setLong("queUsrId",
queUsrId.longValue()).list();
- logger.debug("list: " + list);
+ VoteUsrAttemptDAO.logger.debug("list: " + list);
String openAnswer = "";
Set userEntries = new HashSet();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- logger.debug("attempt: " + attempt);
+ VoteUsrAttemptDAO.logger.debug("attempt: " + attempt);
if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionId.toString())) {
if (!attempt.getVoteQueContentId().toString().equals("1")) {
- logger.debug("adding attempt question : " + attempt.getVoteQueContent().getQuestion());
+ VoteUsrAttemptDAO.logger.debug("adding attempt question : "
+ + attempt.getVoteQueContent().getQuestion());
userEntries.add(attempt.getVoteQueContent().getQuestion());
} else {
- logger.debug("this is a user entered vote: " + attempt.getUserEntry());
+ VoteUsrAttemptDAO.logger.debug("this is a user entered vote: " + attempt.getUserEntry());
if (attempt.getUserEntry().length() > 0) {
openAnswer = attempt.getUserEntry();
- logger.debug("adding openAnswer to userEntries: ");
+ VoteUsrAttemptDAO.logger.debug("adding openAnswer to userEntries: ");
userEntries.add(openAnswer);
}
@@ -407,14 +415,14 @@
}
}
- logger.debug("final userEntries : " + userEntries);
+ VoteUsrAttemptDAO.logger.debug("final userEntries : " + userEntries);
return userEntries;
}
public List getAttemptsListForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong("queUsrId",
- queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT).setLong(
+ "queUsrId", queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
return list;
}
@@ -424,27 +432,29 @@
public List getAttemptForQueContent(final Long queUsrId, final Long voteQueContentId) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_ATTEMPT_FOR_QUE_CONTENT).setLong("queUsrId", queUsrId.longValue())
- .setLong("voteQueContentId", voteQueContentId.longValue()).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_ATTEMPT_FOR_QUE_CONTENT).setLong("queUsrId",
+ queUsrId.longValue()).setLong("voteQueContentId", voteQueContentId.longValue()).list();
return list;
}
public List getUserRecords(final String userEntry) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry",
+ userEntry).list();
return list;
}
public List getUserEnteredVotesForSession(final String userEntry, final Long voteSessionUid) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_USER_ENTRY_RECORDS).setString("userEntry", userEntry).list();
+ List list = getSession().createQuery(VoteUsrAttemptDAO.LOAD_USER_ENTRY_RECORDS).setString("userEntry",
+ userEntry).list();
List sessionUserEntries = new ArrayList();
if (list != null && list.size() > 0) {
Iterator listIterator = list.iterator();
while (listIterator.hasNext()) {
VoteUsrAttempt attempt = (VoteUsrAttempt) listIterator.next();
- logger.debug("attempt: " + attempt);
+ VoteUsrAttemptDAO.logger.debug("attempt: " + attempt);
if (attempt.getVoteQueUsr().getVoteSession().getUid().toString().equals(voteSessionUid.toString())) {
sessionUserEntries.add(attempt.getUserEntry());
}
@@ -453,25 +463,23 @@
return sessionUserEntries;
}
-
public int getSessionEntriesCount(final Long voteSessionUid) {
- List result = getSession().createQuery(COUNT_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid", voteSessionUid)
- .list();
- logger.debug("getSessionEntriesCount: " + result);
- Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0);
- return resultInt.intValue();
+ List result = getSession().createQuery(VoteUsrAttemptDAO.COUNT_ENTRIES_BY_SESSION_ID).setLong("voteSessionUid",
+ voteSessionUid).list();
+ VoteUsrAttemptDAO.logger.debug("getSessionEntriesCount: " + result);
+ Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0);
+ return resultLong.intValue();
}
public int getCompletedSessionEntriesCount(final Long voteSessionUid) {
- List list = (List)getSessionUserEntries(voteSessionUid);
+ List list = getSessionUserEntries(voteSessionUid);
int completedSessionCount = 0;
- for(VoteUsrAttempt att : list)
- {
+ for (VoteUsrAttempt att : list) {
String sessionStatus = att.getVoteQueUsr().getVoteSession().getSessionStatus();
- logger.debug("this is a completed session: " + sessionStatus);
- ++completedSessionCount;
+ VoteUsrAttemptDAO.logger.debug("this is a completed session: " + sessionStatus);
+ ++completedSessionCount;
}
- logger.debug("getCompletedSessionEntriesCount" + completedSessionCount);
+ VoteUsrAttemptDAO.logger.debug("getCompletedSessionEntriesCount" + completedSessionCount);
return completedSessionCount;
}
Index: lams_tool_vote/web/WEB-INF/web.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_vote/web/WEB-INF/web.xml,v
diff -u -r1.17 -r1.17.4.1
--- lams_tool_vote/web/WEB-INF/web.xml 26 Mar 2009 10:00:40 -0000 1.17
+++ lams_tool_vote/web/WEB-INF/web.xml 13 May 2009 12:24:57 -0000 1.17.4.1
@@ -26,13 +26,17 @@
org.lamsfoundation.lams.tool.vote.ApplicationResources
+