com.atlassian.jira.bc.issue.vote
Interface VoteService

All Known Implementing Classes:
DefaultVoteService

public interface VoteService

Vote Service used to add and remove votes from a particular issue. This service's methods will make sure that when voting, all of JIRA's business rules are enforced. This means that permissions and data validation will be checked.

Since:
v4.1

Nested Class Summary
static class VoteService.VoteValidationResult
          A simple validation result that holds the user trying to vote, and the issue being voted on.
 
Method Summary
 int addVote(User remoteUser, VoteService.VoteValidationResult validationResult)
          Adds a new vote using the specified validation result
 int removeVote(User remoteUser, VoteService.VoteValidationResult validationResult)
          Removes a new vote using the specified validation result
 VoteService.VoteValidationResult validateAddVote(User remoteUser, User user, 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 user, Issue issue)
          Validates if the user currently logged in may remove a vote for the user supplied for the issue provided.
 

Method Detail

validateAddVote

VoteService.VoteValidationResult validateAddVote(User remoteUser,
                                                 User user,
                                                 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(com.opensymphony.user.User, com.atlassian.jira.bc.issue.vote.VoteService.VoteValidationResult) method. The following conditions will fail validation:

Parameters:
remoteUser - The currently logged in user
user - 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

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

validateRemoveVote

VoteService.VoteValidationResult validateRemoveVote(User remoteUser,
                                                    User user,
                                                    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(com.opensymphony.user.User, com.atlassian.jira.bc.issue.vote.VoteService.VoteValidationResult) method. The following conditions will fail validation:

Parameters:
remoteUser - The currently logged in user
user - 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

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


Copyright © 2002-2010 Atlassian. All Rights Reserved.