@PublicApi public interface

VoteManager

com.atlassian.jira.issue.vote.VoteManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

The vote manager is responsible for counting issue votes.

Summary

Public Methods
boolean addVote(ApplicationUser user, Issue issue)
Adds a new vote for the user and issue specified.
boolean addVote(ApplicationUser user, GenericValue issue)
This method is deprecated. Use addVote(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0.
int getVoteCount(Issue issue)
Return the number of users that have voted for the given issue.
List<VoteHistoryEntry> getVoteHistory(Issue issue)
Get the list of vote history for an issue.
Collection<String> getVoterUserkeys(Issue issue)
Return a collection of userkeys of users that voted for given issue
@Deprecated Collection<String> getVoterUsernames(GenericValue issue)
This method is deprecated. Use getVoterUsernames(com.atlassian.jira.issue.Issue) instead. Since v6.0.
Collection<String> getVoterUsernames(Issue issue)
This method is deprecated. Use getVoterUserkeys(com.atlassian.jira.issue.Issue) instead. Since v6.0.
List<ApplicationUser> getVoters(Issue issue, Locale usersLocale)
This method is deprecated. Use getVotersFor(com.atlassian.jira.issue.Issue, java.util.Locale) instead. Since v6.0.
List<ApplicationUser> getVotersFor(Issue issue, Locale usersLocale)
Returns an ordered list of voters for a particular issue.
boolean hasVoted(ApplicationUser user, GenericValue issue)
This method is deprecated. Use hasVoted(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0.
boolean hasVoted(ApplicationUser user, Issue issue)
Checks if the given User has voted on the given Issue.
boolean isVotingEnabled()
Retrieves the 'jira.option.voting' property
boolean removeVote(ApplicationUser user, GenericValue issue)
boolean removeVote(ApplicationUser user, Issue issue)
Removes a vote for the user and issue specified.
void removeVotesForUser(ApplicationUser user)
Removes all votes made by user.

Public Methods

public boolean addVote (ApplicationUser user, Issue issue)

Adds a new vote for the user and issue specified.

Parameters
user the User
issue the Issue
Returns
  • True if the vote succeeded. False if the user or issue supplied were null, or if the resolution is set or if voting is disabled.

public boolean addVote (ApplicationUser user, GenericValue issue)

This method is deprecated.
Use addVote(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0.

Adds a new vote for the user and issue specified.

Parameters
user the User
issue the Issue
Returns
  • false, if the user or issue supplied were null, or if the resolution is set or if voting is disabled. True if the vote succeeded.

public int getVoteCount (Issue issue)

Return the number of users that have voted for the given issue.

Parameters
issue issue voted for
Returns
  • the number of users that have voted for the given issue.

public List<VoteHistoryEntry> getVoteHistory (Issue issue)

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

Parameters
issue the issue to view
Returns
  • List of Vote History Entries

public Collection<String> getVoterUserkeys (Issue issue)

Return a collection of userkeys of users that voted for given issue

Parameters
issue issue voted for
Returns
  • a collection of userkeys, never null

@Deprecated public Collection<String> getVoterUsernames (GenericValue issue)

This method is deprecated.
Use getVoterUsernames(com.atlassian.jira.issue.Issue) instead. Since v6.0.

Return a collection of usernames of users that voted for given issue

Parameters
issue issue voted for
Returns
  • a collection of usernames, never null

public Collection<String> getVoterUsernames (Issue issue)

This method is deprecated.
Use getVoterUserkeys(com.atlassian.jira.issue.Issue) instead. Since v6.0.

Return a collection of usernames of users that voted for the given issue.

Parameters
issue the Issue
Returns
  • a collection of usernames, never null

public List<ApplicationUser> getVoters (Issue issue, Locale usersLocale)

This method is deprecated.
Use getVotersFor(com.atlassian.jira.issue.Issue, java.util.Locale) instead. Since v6.0.

Returns an ordered list of voters for a particular issue.

Parameters
issue the Issue
usersLocale the locale of the user making this call which is used to sort the results.
Returns
  • an ordered list of voters for a particular issue.

public List<ApplicationUser> getVotersFor (Issue issue, Locale usersLocale)

Returns an ordered list of voters for a particular issue.

Parameters
issue the Issue
usersLocale the locale of the user making this call which is used to sort the results.
Returns
  • an ordered list of voters for the given issue.

public boolean hasVoted (ApplicationUser user, GenericValue issue)

This method is deprecated.
Use hasVoted(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0.

Checks if the given User has voted on the given Issue. the user supplied.

Parameters
user the User
issue the Issue
Returns
  • True if the user has voted.

public boolean hasVoted (ApplicationUser user, Issue issue)

Checks if the given User has voted on the given Issue.

Parameters
user the User
issue the Issue
Returns
  • True if the user has voted.

public boolean isVotingEnabled ()

Retrieves the 'jira.option.voting' property

Returns
  • True if voting is enabled

public boolean removeVote (ApplicationUser user, GenericValue issue)

This method is deprecated.
Use removeVote(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.issue.Issue) instead. Since v6.0.

Removes a vote for the user and issue specified.

Parameters
user the User
issue the Issue
Returns
  • false, if the user or issue supplied were null, or if the resolution is set or if voting is disabled. True if removing a vote succeeded.

public boolean removeVote (ApplicationUser user, Issue issue)

Removes a vote for the user and issue specified.

Parameters
user the User
issue the Issue
Returns
  • true if removing a vote succeeded.

public void removeVotesForUser (ApplicationUser user)

Removes all votes made by user. Usually means user is being deleted.

Parameters
user user to remove vote associations for.