Interface VotingBatchSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, VotingSession
This session votes in bulk. The data for create and update is provided
by the consumer via the form object. OsidForms are requested for
eachupdate and may not be reused.
Create and update operations differ in their usage. To create a
Vote , a VoteForm is requested using getVoteForms()
specifying the desired race, candidate, and record Types or none
if no record Types are needed. Each of the returned
VoteForms will indicate that it is to be used with a create operation and
can be used to examine metdata or validate data prior to creation. Once a
VoteForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each VoteForm corresponds to an attempted transaction.
The VoteForms returned from getVoteForms() may be
linked to the originating request through the peer Ids of the
VoteForm . In the case where there may be duplicates, any
VoteForm of the same peer Ids may be used for a create operation.
Once a batch of VoteForms are submitted for create, a
CreateResponse is returned for each VoteForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from castVotes() errors specific to an
individual VoteForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
VoteForm through the VoteForm Id .
The delete operations delete Votes in bulk. Bulk delete
operations return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasVotes(AliasRequestList aliasRequests) Adds anIdto aVotefor the purpose of creating compatibility.castVotes(VoteBatchFormList voteForms) Creates a new set ofVotes.Deletes allVotesin thisPolls.Deletes votes ineffective before the given date.deleteVotes(IdList voteIds) Deletes votes for the givenIds.deleteVotesForBallot(Id ballotId) Deletes all votes for all races on a ballot.deleteVotesForRace(Id raceId) Deletes votes for the given race.deleteVotesForVoter(Id resourceId) Deletes votes cast by a voter.getVoteForms(VotePeerList peers, Type[] voteRecordTypes) Gets the vote forms for casting a bunch of new votes.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.Methods inherited from interface VotingSession
canRevote, canVote, canVoteWithRecordTypes, deleteMyVote, getMyUncastRacesForBallot, getMyVotesForBallot, getMyVotesForRace, getPolls, getPollsId, getRace, getRacesForBallot, getVoteForm, getVotingAllocation, isOpen, voteModifier and TypeMethodDescriptionbooleanTests if this user can change a vote by deleting a vote and voting again.booleancanVote()Tests if this user can vote.booleancanVoteWithRecordTypes(Id raceId, Type[] voteRecordTypes) Tests if this user can create a singleVoteusing the desired record interface types.voiddeleteMyVote(Id voteId) Deletes a vote in a race.getMyUncastRacesForBallot(Id ballotId) Gets allRaceson this ballot for which a vote has not been cast.getMyVotesForBallot(Id ballotId) Gets all myVotescast on a ballot.getMyVotesForRace(Id raceId) Gets all myVotescast on this ballot for the given race.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.Gets a race.getRacesForBallot(Id ballotId) Gets allRaceson this ballot.getVoteForm(Id raceId, Id candidateId, Type[] voteRecordTypes) Gets a vote form for a race.getVotingAllocation(Id raceId) Gets the voter allocation for a race.booleanisOpen()Tests if this ballot is open.Votes for a candidate in a race.
-
Method Details
-
getVoteForms
VoteBatchFormList getVoteForms(VotePeerList peers, Type[] voteRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the vote forms for casting a bunch of new votes. A vote form is returned for each supplied race and candidate pair.- Parameters:
peers- the vote peersvoteRecordTypes- array of vote record types to be included in each create operation or an empty list if none- Returns:
- the vote forms
- Throws:
NotFoundException- araceIdorcandidateIdis not foundNullArgumentException-peersorvoteRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
castVotes
CreateResponseList castVotes(VoteBatchFormList voteForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofVotes. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
voteForms- the vote forms- Returns:
- the create responses
- Throws:
NullArgumentException-voteFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllVotes
Deletes allVotesin thisPolls.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteVotes
DeleteResponseList deleteVotes(IdList voteIds) throws OperationFailedException, PermissionDeniedException Deletes votes for the givenIds.- Parameters:
voteIds- theIdsof the votes to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-voteIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteVotesForRace
DeleteResponseList deleteVotesForRace(Id raceId) throws OperationFailedException, PermissionDeniedException Deletes votes for the given race.- Parameters:
raceId- theIdsof a race- Returns:
- the delete responses
- Throws:
NullArgumentException-raceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteVotesForVoter
DeleteResponseList deleteVotesForVoter(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes votes cast by a voter.- Parameters:
resourceId- theIdsof a resource- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteVotesForBallot
DeleteResponseList deleteVotesForBallot(Id ballotId) throws OperationFailedException, PermissionDeniedException Deletes all votes for all races on a ballot.- Parameters:
ballotId- theIdsof a ballot- Returns:
- the delete responses
- Throws:
NullArgumentException-ballotIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveVotesByDate
DeleteResponseList deleteIneffectiveVotesByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes votes ineffective before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasVotes
AliasResponseList aliasVotes(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aVotefor the purpose of creating compatibility. The primaryIdof theVoteis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another vote, it is reassigned to the given voteId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-