Package io.meeds.poll.service
Interface PollService
@Service
public interface PollService
-
Method Summary
Modifier and TypeMethodDescriptioncreatePoll(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 pollbooleanChecks if the user voted in the pollgetPollById(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.intgetPollOptionsNumber(long pollId, org.exoplatform.services.security.Identity currentIdentity) Retrieves the number of poll options identified by its technical identifierintgetPollOptionTotalVotes(long pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity) Retrieves total votes of a poll option identified by its technical identifierintgetPollTotalVotes(long pollId, org.exoplatform.services.security.Identity currentIdentity) Retrieves total votes of a poll identified by its technical identifierbooleanisPollOptionVoted(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-Pollobject to createpollOptions-Polloptions objects to createspaceId-Spaceid related to thePollto be createdmessage- Message ofPollactivity to be createdcurrentIdentity- User identity creating thePoll- Returns:
- created
Pollwith generated technical identifier - Throws:
IllegalAccessException- when the current user is not authorized to create aPoll
-
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 aPollcurrentIdentity- User identity getting thePoll- Returns:
- A
Pollobject - Throws:
IllegalAccessException- when the current user is not authorized to get aPoll
-
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 aPollcurrentIdentity- User identity getting thePolloption- Returns:
- A
Polloption object - Throws:
IllegalAccessException- when the current user is not authorized to get aPolloption
-
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 aPollcurrentIdentity- User identity getting thePolloptions- Returns:
- A
Pollobject - Throws:
IllegalAccessException- when the current user is not authorized to get poll options of aPoll
-
vote
PollVote vote(String pollOptionId, String spaceId, org.exoplatform.services.security.Identity currentIdentity) throws IllegalAccessException Votes a poll option- Parameters:
pollOptionId-Polloption id to be votedspaceId-Spaceid related to the votedPollcurrentIdentity- User identity voting in thePoll- Returns:
- created
Pollvote 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-Polloption technical identifierspaceId-Spaceid related to thePolloptioncurrentIdentity- User identity- Returns:
- The
Polloption total votes - Throws:
IllegalAccessException- when the current user is not authorized to get thePolloption 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-Polloption technical identifier to be checked if it is votedspaceId-Spaceid related to thePolloptioncurrentIdentity- User identity to be checked if he has voted thePolloption- Returns:
- A
which indicates if the current identity has voted the
invalid reference
booleanPolloption - Throws:
IllegalAccessException- when the current user is not authorized to check if thePolloption 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 aPollcurrentIdentity- User identifier getting thePolloptions number- Returns:
- The
Polloptions number - Throws:
IllegalAccessException- when the current user is not authorized to getPolloptions 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 aPollcurrentIdentity- User identifier getting thePolltotal votes- Returns:
- The
Polltotal votes - Throws:
IllegalAccessException- when the current user is not authorized to getPolltotal votes
-
didVote
Checks if the user voted in the poll- Parameters:
currentIdentity- User identifier representing The VoterpollId- technical identifier of the poll- Returns:
- boolean true if the user did already vote this Poll
-