public interface VotingSession extends OsidSession
This session provides methods for voting on a ballot.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRevote(Id ballotId)
Tests if this user can change a vote by deleting a vote and voting
again.
|
boolean |
canVote()
Tests if this user can vote.
|
boolean |
canVoteWithRecordTypes(Id raceId,
Type[] voteRecordTypes)
Tests if this user can create a single
Vote using the
desired record interface types. |
void |
deleteMyVote(Id voteId)
Deletes a vote in a race.
|
RaceList |
getMyUncastRacesForBallot(Id ballotId)
Gets all
Races on this ballot for which a vote has not
been cast. |
VoteList |
getMyVotesForBallot(Id ballotId)
Gets all my
Votes cast on a ballot. |
VoteList |
getMyVotesForRace(Id raceId)
Gets all my
Votes cast on this ballot for the given
race. |
Polls |
getPolls()
Gets the
Polls associated with this session. |
Id |
getPollsId()
Gets the
Polls Id associated with this
session. |
Race |
getRace(Id raceId)
Gets a race.
|
RaceList |
getRacesForBallot(Id ballotId)
Gets all
Races on this ballot. |
VoteForm |
getVoteForm(Id raceId,
Id candidateId,
Type[] voteRecordTypes)
Gets a vote form for a race.
|
VoterAllocation |
getVotingAllocation(Id raceId)
Gets the voter allocation for a race.
|
boolean |
isOpen()
Tests if this ballot is open.
|
Vote |
vote(VoteForm voteForm)
Votes for a candidate in a race.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getPollsId()
Polls Id associated with this
session. Polls Id associated with this sessionmandatory - This method must be implemented. Polls getPolls() throws OperationFailedException, PermissionDeniedException
Polls associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isOpen()
true if the ballot is open, false
otherwisemandatory - This method must be implemented. boolean canVote()
PERMISSION_DENIED.
This is intended as a hint to an application that may opt not
to offer relationship operations. false if voting methods are not authorized,
true otherwisemandatory - This method must be implemented. Race getRace(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
raceId - Id of the Race NotFoundException - raceId not foundNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method is must be implemented. RaceList getRacesForBallot(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Races on this ballot.ballotId - Id of the Ballot NotFoundException - ballotId not foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. RaceList getMyUncastRacesForBallot(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Races on this ballot for which a vote has not
been cast.ballotId - Id of the Ballot NotFoundException - ballotId not foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canVoteWithRecordTypes(Id raceId, Type[] voteRecordTypes)
Vote using the
desired record interface types. While
VotingManager.getVoteRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Vote. Providing an
empty array tests if an Vote can be created with no
records.raceId - a race Id voteRecordTypes - array of vote record types true if Vote creation using the
specified record Types is supported,
false otherwiseNullArgumentException - ballotId or
voteRecordTypes is null mandatory - This method must be implemented. VoterAllocation getVotingAllocation(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
raceId - Id of the Race NotFoundException - raceId not foundNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method is must be implemented. VoteForm getVoteForm(Id raceId, Id candidateId, Type[] voteRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
raceId - Id of the Race candidateId - a candidatevoteRecordTypes - array of vote record typesNotFoundException - raceId or
candidateId not foundNullArgumentException - raceId, candidateId,
or voteRecordTypes is null
OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - cannot get form with requested
record typesmandatory - This method is must be implemented. Vote vote(VoteForm voteForm) throws OperationFailedException, PermissionDeniedException
voteForm - the vote formIllegalStateException - voteForm already
used in a voting transactionInvalidArgumentException - form is invalidNullArgumentException - voteForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - voteForm did not
originate from getVoteForm() mandatory - This method must be implemented. VoteList getMyVotesForBallot(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Votes cast on a ballot.ballotId - a ballotNotFoundException - ballotId is not
foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. VoteList getMyVotesForRace(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Votes cast on this ballot for the given
race.raceId - a raceNotFoundException - raceId is not foundNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canRevote(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
ballotId - a ballot true if changing a vote is permitted,
false otherwiseNotFoundException - ballotId is not
foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void deleteMyVote(Id voteId) throws NotFoundException, OperationFailedException, PermissionDeniedException
voteId - a voteIllegalStateException - canRevote() is
false NotFoundException - voteId is not foundNullArgumentException - voteId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.