Interface PollService


  • public interface PollService
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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)
      Creates a new poll
      boolean didVote​(org.exoplatform.services.security.Identity currentIdentity, Long pollId)
      Checks if the user voted in the poll
      Poll getPollById​(long pollId, org.exoplatform.services.security.Identity currentIdentity)
      Retrieves a poll identified by its technical identifier.
      PollOption getPollOptionById​(long pollOptionId, org.exoplatform.services.security.Identity currentIdentity)
      Retrieves a poll option identified by its technical identifier.
      List<PollOption> 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.
      PollVote vote​(String pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity)
      Votes a poll option
    • Method Detail

      • 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:
        pollId - 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