com.atlassian.jira.bc.issue.vote
Class DefaultVoteService

java.lang.Object
  extended by com.atlassian.jira.bc.issue.vote.DefaultVoteService
All Implemented Interfaces:
VoteService

public class DefaultVoteService
extends Object
implements VoteService


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.issue.vote.VoteService
VoteService.VoteValidationResult
 
Constructor Summary
DefaultVoteService(VoteManager voteManager, I18nHelper.BeanFactory beanFactory, ApplicationProperties applicationProperties, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
           
 
Method Summary
 int addVote(com.atlassian.crowd.embedded.api.User remoteUser, VoteService.VoteValidationResult validationResult)
          Adds a new vote using the specified validation result
 ServiceOutcome<List<VoteHistoryEntry>> getVoterHistory(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Get the list of vote history for an issue.
 boolean hasVoted(Issue issue, com.atlassian.crowd.embedded.api.User user)
          Find if the specified user has voted on an issue
 boolean isVotingEnabled()
          Retrieves the 'jira.option.voting' property
 int removeVote(com.atlassian.crowd.embedded.api.User remoteUser, VoteService.VoteValidationResult validationResult)
          Removes a new vote using the specified validation result
 VoteService.VoteValidationResult validateAddVote(com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.embedded.api.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(com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.embedded.api.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<com.atlassian.crowd.embedded.api.User>> viewVoters(Issue issue, com.atlassian.crowd.embedded.api.User remoteUser)
          Get the list of all users who have voted on an issue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultVoteService

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

validateAddVote

public VoteService.VoteValidationResult validateAddVote(com.atlassian.crowd.embedded.api.User remoteUser,
                                                        com.atlassian.crowd.embedded.api.User voter,
                                                        Issue issue)
Description copied from interface: VoteService
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 VoteService.addVote(User, VoteValidationResult) method. The following conditions will fail validation:

Specified by:
validateAddVote in interface VoteService
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

addVote

public int addVote(com.atlassian.crowd.embedded.api.User remoteUser,
                   VoteService.VoteValidationResult validationResult)
Description copied from interface: VoteService
Adds a new vote using the specified validation result

Specified by:
addVote in interface VoteService
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

validateRemoveVote

public VoteService.VoteValidationResult validateRemoveVote(com.atlassian.crowd.embedded.api.User remoteUser,
                                                           com.atlassian.crowd.embedded.api.User voter,
                                                           Issue issue)
Description copied from interface: VoteService
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 VoteService.removeVote(User, VoteValidationResult) method. The following conditions will fail validation:

Specified by:
validateRemoveVote in interface VoteService
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

removeVote

public int removeVote(com.atlassian.crowd.embedded.api.User remoteUser,
                      VoteService.VoteValidationResult validationResult)
Description copied from interface: VoteService
Removes a new vote using the specified validation result

Specified by:
removeVote in interface VoteService
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

viewVoters

public ServiceOutcome<Collection<com.atlassian.crowd.embedded.api.User>> viewVoters(Issue issue,
                                                                                    com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: VoteService
Get the list of all users who have voted on an issue.

Specified by:
viewVoters in interface VoteService
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.

getVoterHistory

public ServiceOutcome<List<VoteHistoryEntry>> getVoterHistory(Issue issue,
                                                              com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: VoteService
Get the list of vote history for an issue. The history will be in time sequence.

Specified by:
getVoterHistory in interface VoteService
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.

isVotingEnabled

public boolean isVotingEnabled()
Description copied from interface: VoteService
Retrieves the 'jira.option.voting' property

Specified by:
isVotingEnabled in interface VoteService
Returns:
True if voting is enabled

hasVoted

public boolean hasVoted(Issue issue,
                        com.atlassian.crowd.embedded.api.User user)
Description copied from interface: VoteService
Find if the specified user has voted on an issue

Specified by:
hasVoted in interface VoteService
Parameters:
issue - the issue to check
user - the user to check
Returns:
true if the user has voted on the issue


Copyright © 2002-2012 Atlassian. All Rights Reserved.