public class DefaultVoteService extends Object implements VoteService
VoteService.VoteValidationResult
Constructor and Description |
---|
DefaultVoteService(VoteManager voteManager,
I18nHelper.BeanFactory beanFactory,
ApplicationProperties applicationProperties,
PermissionManager permissionManager,
I18nHelper.BeanFactory i18nFactory) |
Modifier and Type | Method and Description |
---|---|
int |
addVote(ApplicationUser remoteUser,
VoteService.VoteValidationResult validationResult)
Adds a new vote using the specified validation result.
|
ServiceOutcome<List<VoteHistoryEntry>> |
getVoterHistory(Issue issue,
ApplicationUser remoteUser)
Get the list of vote history for an issue.
|
boolean |
hasVoted(Issue issue,
ApplicationUser user)
Find if the specified user has voted on an issue
|
boolean |
isVotingEnabled()
Retrieves the 'jira.option.voting' property
|
int |
removeVote(ApplicationUser remoteUser,
VoteService.VoteValidationResult validationResult)
Removes a new vote using the specified validation result.
|
VoteService.VoteValidationResult |
validateAddVote(ApplicationUser remoteUser,
ApplicationUser voter,
Issue issue)
Validates if the user currently logged in may add a vote by the user supplied for the issue provided.
|
VoteService.VoteValidationResult |
validateRemoveVote(ApplicationUser remoteUser,
ApplicationUser voter,
Issue issue)
Validates if the user currently logged in may remove a vote for the user supplied for the issue provided.
|
ServiceOutcome<Collection<ApplicationUser>> |
viewVoters(Issue issue,
ApplicationUser remoteUser)
Get the list of all users who have voted on an issue.
|
public DefaultVoteService(VoteManager voteManager, I18nHelper.BeanFactory beanFactory, ApplicationProperties applicationProperties, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
public VoteService.VoteValidationResult validateAddVote(ApplicationUser remoteUser, ApplicationUser voter, Issue issue)
VoteService
VoteService.VoteValidationResult
produced by this method should be
used in conjunction with the VoteService.addVote(ApplicationUser, VoteValidationResult)
method.
The following conditions will fail validation:
validateAddVote
in interface VoteService
remoteUser
- The currently logged in uservoter
- The user for whom a vote is being addedissue
- The issue being voted onpublic int addVote(ApplicationUser remoteUser, VoteService.VoteValidationResult validationResult)
VoteService
addVote
in interface VoteService
remoteUser
- The currently logged in uservalidationResult
- Validation result for adding a new votepublic VoteService.VoteValidationResult validateRemoveVote(ApplicationUser remoteUser, ApplicationUser voter, Issue issue)
VoteService
VoteService.VoteValidationResult
produced by this method should be
used in conjunction with the VoteService.removeVote(ApplicationUser, VoteValidationResult)
method.
The following conditions will fail validation:
validateRemoveVote
in interface VoteService
remoteUser
- The currently logged in uservoter
- The user for whom a vote is being removedissue
- The issue being voted onpublic int removeVote(ApplicationUser remoteUser, VoteService.VoteValidationResult validationResult)
VoteService
removeVote
in interface VoteService
remoteUser
- The currently logged in uservalidationResult
- Validation result for removing a new votepublic ServiceOutcome<Collection<ApplicationUser>> viewVoters(Issue issue, ApplicationUser remoteUser)
VoteService
viewVoters
in interface VoteService
issue
- the issue to viewremoteUser
- the user who wants to knowpublic ServiceOutcome<List<VoteHistoryEntry>> getVoterHistory(Issue issue, ApplicationUser remoteUser)
VoteService
getVoterHistory
in interface VoteService
issue
- the issue to viewremoteUser
- the user who wants to knowpublic boolean isVotingEnabled()
VoteService
isVotingEnabled
in interface VoteService
public boolean hasVoted(Issue issue, ApplicationUser user)
VoteService
hasVoted
in interface VoteService
issue
- the issue to checkuser
- the user to checkCopyright © 2002-2019 Atlassian. All Rights Reserved.