Package org.sakaiproject.poll.logic
Interface PollVoteManager
-
public interface PollVoteManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeleteAll(List<Vote> votes)Delete the given votesvoiddeleteVote(Vote vote)Delete the given voteList<Vote>getAllVotesForOption(Option option)Get all votes for OptionList<Vote>getAllVotesForPoll(Poll poll)intgetDisctinctVotersForPoll(Poll poll)VotegetVoteById(Long voteId)Get a vote by idMap<Long,List<Vote>>getVotesForUser(String userId, Long[] pollIds)Get all the votes for a specific user in a poll or polls (or all polls)booleanisUserAllowedVote(String userId, Long pollId, boolean ignoreVoted)Check if the given user can vote in the supplied poll, also checks if the user has already voted, if so this will return falsebooleanpollIsVotable(Poll poll)Is the current user able to vote on this poll?booleansaveVote(Vote vote)voidsaveVoteList(List<Vote> voteCollection)Save a vote collection - a users collection of votes for a specific pollbooleanuserHasVoted(Long pollid)Assumes current userbooleanuserHasVoted(Long pollid, String userID)
-
-
-
Method Detail
-
getVoteById
Vote getVoteById(Long voteId)
Get a vote by id- Parameters:
voteId-- Returns:
- the vote OR null if not found
-
saveVote
boolean saveVote(Vote vote)
-
saveVoteList
void saveVoteList(List<Vote> voteCollection)
Save a vote collection - a users collection of votes for a specific poll- Parameters:
voteCollection-
-
isUserAllowedVote
boolean isUserAllowedVote(String userId, Long pollId, boolean ignoreVoted)
Check if the given user can vote in the supplied poll, also checks if the user has already voted, if so this will return false- Parameters:
userId- an internal user idpollId- the id of a pollignoreVoted- if true then ignores the user's vote when checking, else will only return true if the user is allowed AND has not already voted- Returns:
- true if user can vote OR false if not
-
userHasVoted
boolean userHasVoted(Long pollid)
Assumes current user- Parameters:
pollid-- Returns:
-
getDisctinctVotersForPoll
int getDisctinctVotersForPoll(Poll poll)
-
getVotesForUser
Map<Long,List<Vote>> getVotesForUser(String userId, Long[] pollIds)
Get all the votes for a specific user in a poll or polls (or all polls)- Parameters:
userId- an internal user id (not username)pollIds- an array of all polls to get the votes for (null to get all)- Returns:
- the map of poll ID => list of votes for that poll for this user
-
getAllVotesForOption
List<Vote> getAllVotesForOption(Option option)
Get all votes for Option- Parameters:
option-- Returns:
-
pollIsVotable
boolean pollIsVotable(Poll poll)
Is the current user able to vote on this poll?- Parameters:
poll-- Returns:
-
deleteVote
void deleteVote(Vote vote)
Delete the given vote- Parameters:
vote- The vote to delete
-
-