Interface PollService


@Service public interface PollService
  • Method Summary

    Modifier and Type
    Method
    Description
    createPoll(Poll poll, List<PollOption> pollOptions, String spaceId, String message, org.exoplatform.services.security.Identity currentIdentity, List<org.exoplatform.social.core.activity.model.ActivityFile> files)
    Creates a new poll
    boolean
    didVote(org.exoplatform.services.security.Identity currentIdentity, Long pollId)
    Checks if the user voted in the poll
    getPollById(long pollId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves a poll identified by its technical identifier.
    getPollOptionById(long pollOptionId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves a poll option identified by its technical identifier.
    getPollOptionsByPollId(long pollId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves options of a poll identified by its technical identifier.
    int
    getPollOptionsNumber(long pollId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves the number of poll options identified by its technical identifier
    int
    getPollOptionTotalVotes(long pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves total votes of a poll option identified by its technical identifier
    int
    getPollTotalVotes(long pollId, org.exoplatform.services.security.Identity currentIdentity)
    Retrieves total votes of a poll identified by its technical identifier
    boolean
    isPollOptionVoted(long pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity)
    Checks if a the current user has voted a poll option identified by its technical identifier.
    vote(String pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity)
    Votes a poll option
  • Method Details

    • createPoll

      Poll createPoll(Poll poll, List<PollOption> pollOptions, String spaceId, String message, org.exoplatform.services.security.Identity currentIdentity, List<org.exoplatform.social.core.activity.model.ActivityFile> files) throws IllegalAccessException
      Creates a new poll
      Parameters:
      poll - Poll object to create
      pollOptions - Poll options objects to create
      spaceId - Space id related to the Poll to be created
      message - Message of Poll activity to be created
      currentIdentity - User identity creating the Poll
      Returns:
      created Poll with generated technical identifier
      Throws:
      IllegalAccessException - when the current user is not authorized to create a Poll
    • getPollById

      Poll getPollById(long pollId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves a poll identified by its technical identifier.
      Parameters:
      pollId - technical identifier of a Poll
      currentIdentity - User identity getting the Poll
      Returns:
      A Poll object
      Throws:
      IllegalAccessException - when the current user is not authorized to get a Poll
    • getPollOptionById

      PollOption getPollOptionById(long pollOptionId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves a poll option identified by its technical identifier.
      Parameters:
      pollOptionId - technical identifier of a Poll
      currentIdentity - User identity getting the Poll option
      Returns:
      A Poll option object
      Throws:
      IllegalAccessException - when the current user is not authorized to get a Poll option
    • getPollOptionsByPollId

      List<PollOption> getPollOptionsByPollId(long pollId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves options of a poll identified by its technical identifier.
      Parameters:
      pollId - technical identifier of a Poll
      currentIdentity - User identity getting the Poll options
      Returns:
      A Poll object
      Throws:
      IllegalAccessException - when the current user is not authorized to get poll options of a Poll
    • vote

      PollVote vote(String pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Votes a poll option
      Parameters:
      pollOptionId - Poll option id to be voted
      spaceId - Space id related to the voted Poll
      currentIdentity - User identity voting in the Poll
      Returns:
      created Poll vote with generated technical identifier
      Throws:
      IllegalAccessException - when the current user is not authorized to vote
    • getPollOptionTotalVotes

      int getPollOptionTotalVotes(long pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves total votes of a poll option identified by its technical identifier
      Parameters:
      pollOptionId - Poll option technical identifier
      spaceId - Space id related to the Poll option
      currentIdentity - User identity
      Returns:
      The Poll option total votes
      Throws:
      IllegalAccessException - when the current user is not authorized to get the Poll option total votes
    • isPollOptionVoted

      boolean isPollOptionVoted(long pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Checks if a the current user has voted a poll option identified by its technical identifier.
      Parameters:
      pollOptionId - Poll option technical identifier to be checked if it is voted
      spaceId - Space id related to the Poll option
      currentIdentity - User identity to be checked if he has voted the Poll option
      Returns:
      A boolean which indicates if the current identity has voted the Poll option
      Throws:
      IllegalAccessException - when the current user is not authorized to check if the Poll option is voted
    • getPollOptionsNumber

      int getPollOptionsNumber(long pollId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves the number of poll options identified by its technical identifier
      Parameters:
      pollId - technical identifier of a Poll
      currentIdentity - User identifier getting the Poll options number
      Returns:
      The Poll options number
      Throws:
      IllegalAccessException - when the current user is not authorized to get Poll options number
    • getPollTotalVotes

      int getPollTotalVotes(long pollId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException
      Retrieves total votes of a poll identified by its technical identifier
      Parameters:
      pollId - technical identifier of a Poll
      currentIdentity - User identifier getting the Poll total votes
      Returns:
      The Poll total votes
      Throws:
      IllegalAccessException - when the current user is not authorized to get Poll total votes
    • didVote

      boolean didVote(org.exoplatform.services.security.Identity currentIdentity, Long pollId)
      Checks if the user voted in the poll
      Parameters:
      currentIdentity - User identifier representing The Voter
      pollId - technical identifier of the poll
      Returns:
      boolean true if the user did already vote this Poll