OSID Logo
OSID Specifications
voting package
Version 3.1.0
Interfaceosid.voting.VoteAdminSession
Implementsosid.OsidSession
Implemented Byosid.voting.batch.VoteBatchAdminSession
Used Byosid.voting.VotingManager
osid.voting.VotingProxyManager
Description

This session creates, updates, and deletes Votes. The data for create and update is provided by the consumer via the form object. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a Vote, a VoteForm is requested using getVoteFormForCreate() specifying the Race and desired record Types or none if no record Types are needed. The returned VoteForm will indicate that it is to be used with a create operation and can be used to examine metadata or validate data prior to creation. Once the 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.

For updates, VoteForms are requested to the Vote Id that is to be updated using getVoteFormForUpdate(). Similarly, the VoteForm has metadata about the data that can be updated and it can perform validation before submitting the update. The VoteForm can only be used once for a successful update and cannot be reused.

The delete operations delete Votes. To unmap a Vote from the current Polls, the VotePollsAssignmentSession should be used. These delete operations attempt to remove the Vote itself thus removing it from all known Polls catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

Like all OsidSessions, VoteAdminSessions are dedicated to single processing threads and a single authenticated user.

MethodgetPollsId
Description

Gets the Polls Id associated with this session.

Returnosid.id.Id the Polls Id associated with this session
Compliancemandatory This method must be implemented.
MethodgetPolls
Description

Gets the Polls associated with this session.

Returnosid.voting.Polls the Polls associated with this session
ErrorsOPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodcanCreateVotes
Description

Tests if this user can create Votes. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Vote will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.

Returnboolean false if Vote creation is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodcanCreateVoteWithRecordTypes
Description

Tests if this user can create a single Vote using the desired record 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 a Vote can be created with no records.

Parametersosid.type.Type[]voteRecordTypes array of vote record types
Returnboolean true if Vote creation using the specified Types is supported, false otherwise
ErrorsNULL_ARGUMENT voteRecordTypes is null
Compliancemandatory This method must be implemented.
MethodgetVoteFormForCreate
Description

Gets the vote form for creating new votes. A new form should be requested for each create transaction.

Parametersosid.id.IdcandidateId the candidate Id
osid.id.IdvoterId the voter Id
osid.type.Type[]voteRecordTypes array of vote record types
Returnosid.voting.VoteForm the vote form
ErrorsNOT_FOUND candidateId or voterId is not found
NULL_ARGUMENT candidateId, voterId or voteRecordTypes is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED unable to get form with requested record types
Compliancemandatory This method must be implemented.
MethodcreateVote
Description

Creates a new Vote.

Parametersosid.voting.VoteFormvoteForm the form for this Vote
Returnosid.voting.Vote the new Vote
ErrorsILLEGAL_STATE voteForm already used in a create transaction
INVALID_ARGUMENT one or more of the form elements is invalid
NULL_ARGUMENT voteForm is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED voteForm did not originate from getVoteFormForCreate()
Compliancemandatory This method must be implemented.
MethodcanUpdateVotes
Description

Tests if this user can update Votes. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Vote will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.

Returnboolean false if Vote modification is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodgetVoteFormForUpdate
Description

Gets the vote form for updating an existing vote. A new vote form should be requested for each update transaction.

Parametersosid.id.IdvoteId the Id of the Vote
Returnosid.voting.VoteForm the vote form
ErrorsNOT_FOUND voteId is not found
NULL_ARGUMENT voteId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodupdateVote
Description

Updates an existing vote.

Parametersosid.voting.VoteFormvoteForm the form containing the elements to be updated
ErrorsILLEGAL_STATE voteForm already used in an update transaction
INVALID_ARGUMENT the form contains an invalid value
NULL_ARGUMENT voteForm is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED voteForm did not originate from getVoteFormForUpdate()
Compliancemandatory This method must be implemented.
MethodcanDeleteVotes
Description

Tests if this user can delete Votes. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Vote will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.

Returnboolean false if Vote deletion is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethoddeleteVote
Description

Deletes a Vote.

Parametersosid.id.IdvoteId the Id of the Vote to remove
ErrorsNOT_FOUND voteId not found
NULL_ARGUMENT voteId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodcanManageVoteAliases
Description

Tests if this user can manage Id aliases for Votes. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.

Returnboolean false if Vote aliasing is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodaliasVote
Description

Adds an Id to a Vote for the purpose of creating compatibility. The primary Id of the Vote is determined by the provider. The new Id performs as an alias to the primary Id. If the alias is a pointer to another vote it is reassigned to the given vote Id.

Parametersosid.id.IdvoteId the Id of a Vote
osid.id.IdaliasId the alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND voteId not found
NULL_ARGUMENT aliasId or voteId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.