public class

DefaultVoteService

extends Object
implements VoteService
java.lang.Object
   ↳ com.atlassian.jira.bc.issue.vote.DefaultVoteService

Summary

Public Constructors
DefaultVoteService(VoteManager voteManager, I18nHelper.BeanFactory beanFactory, ApplicationProperties applicationProperties, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
Public Methods
int addVote(User remoteUser, VoteService.VoteValidationResult validationResult)
Adds a new vote using the specified validation result
ServiceOutcome<List<VoteHistoryEntry>> getVoterHistory(Issue issue, User remoteUser)
Get the list of vote history for an issue.
boolean hasVoted(Issue issue, User user)
Find if the specified user has voted on an issue
boolean isVotingEnabled()
Retrieves the 'jira.option.voting' property
int removeVote(User remoteUser, VoteService.VoteValidationResult validationResult)
Removes a new vote using the specified validation result
VoteService.VoteValidationResult validateAddVote(User remoteUser, User 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(User remoteUser, User voter, Issue issue)
Validates if the user currently logged in may remove a vote for the user supplied for the issue provided.
ServiceOutcome<Collection<User>> viewVoters(Issue issue, User remoteUser)
Get the list of all users who have voted on an issue.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.issue.vote.VoteService

Public Constructors

public DefaultVoteService (VoteManager voteManager, I18nHelper.BeanFactory beanFactory, ApplicationProperties applicationProperties, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)

Public Methods

public int addVote (User remoteUser, VoteService.VoteValidationResult validationResult)

Adds a new vote using the specified validation result

Parameters
remoteUser The currently logged in user
validationResult Validation result for adding a new vote
Returns
  • The updated number of votes for the issue being voted for

public ServiceOutcome<List<VoteHistoryEntry>> getVoterHistory (Issue issue, User remoteUser)

Get the list of vote history for an issue. The history will be in time sequence.

Parameters
issue the issue to view
remoteUser the user who wants to know
Returns
  • a service outcome. if valid you can obtain the users that have voted on the.

public boolean hasVoted (Issue issue, User user)

Find if the specified user has voted on an issue

Parameters
issue the issue to check
user the user to check
Returns
  • true if the user has voted on the issue

public boolean isVotingEnabled ()

Retrieves the 'jira.option.voting' property

Returns
  • True if voting is enabled

public int removeVote (User remoteUser, VoteService.VoteValidationResult validationResult)

Removes a new vote using the specified validation result

Parameters
remoteUser The currently logged in user
validationResult Validation result for removing a new vote
Returns
  • The updated number of votes for the issue being voted for

public VoteService.VoteValidationResult validateAddVote (User remoteUser, User voter, Issue issue)

Validates if the user currently logged in may add a vote by the user supplied for the issue provided. The remoteUser and user arguments may be the same if the current user is voting him/herself. The VoteService.VoteValidationResult produced by this method should be used in conjunction with the addVote(User, VoteValidationResult) method. The following conditions will fail validation:

  • remoteUser is null (i.e. not logged in)
  • the user is the reporter of the issue
  • the issue has already been resolved
  • the user has already voted for this issue
  • voting has been disabled system wide
  • the user doesn't have permission to browse the issue

Parameters
remoteUser The currently logged in user
voter The user for whom a vote is being added
issue The issue being voted on
Returns
  • A validation result containing all errors, as well as the user and issue being voted on

public VoteService.VoteValidationResult validateRemoveVote (User remoteUser, User voter, Issue issue)

Validates if the user currently logged in may remove a vote for the user supplied for the issue provided. The remoteUser and user arguments may be the same if the current user is voting him/herself. The VoteService.VoteValidationResult produced by this method should be used in conjunction with the removeVote(User, VoteValidationResult) method. The following conditions will fail validation:

  • remoteUser is null (i.e. not logged in)
  • the user is the reporter of the issue
  • the issue has already been resolved
  • the user has not yet voted for this issue
  • voting has been disabled system wide
  • the user doesn't have permission to browse the issue

Parameters
remoteUser The currently logged in user
voter The user for whom a vote is being removed
issue The issue being voted on
Returns
  • A validation result containing all errors, as well as the user and issue being voted on

public ServiceOutcome<Collection<User>> viewVoters (Issue issue, User remoteUser)

Get the list of all users who have voted on an issue.

Parameters
issue the issue to view
remoteUser the user who wants to know
Returns
  • a service outcome. if valid you can obtain the users that have voted on the.