Interface PollVoteManager


  • public interface PollVoteManager
    • 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 -
      • getAllVotesForPoll

        List<Vote> getAllVotesForPoll​(Poll poll)
      • 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 id
        pollId - the id of a poll
        ignoreVoted - 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,
                             String userID)
      • 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
      • deleteAll

        void deleteAll​(List<Vote> votes)
        Delete the given votes
        Parameters:
        votes - The votes to delete