OSID Logo
OSID Specifications
voting package
Version 3.0.0
Release Candidate Preview
Interfaceosid.voting.BallotAdminSession
Implementsosid.OsidSession
Description

This session creates, updates, and deletes Ballots. 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 Ballot, a BallotForm is requested using getBallotFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned BallotForm 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 the BallotForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each BallotForm corresponds to an attempted transaction.

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

The delete operations delete Ballots. To unmap a Ballot from the current Polls, the BallotPollsAssignmentSession should be used. These delete operations attempt to remove the Ballot 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.

MethodgetPollsId
Description

Gets the Polls Id associated with this session.

Returnosid.id.Idthe Polls Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetPolls
Description

Gets the Polls associated with this session.

Returnosid.voting.Pollsthe Polls associated with this session
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanCreateBallots
Description

Tests if this user can create Ballots. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Ballot 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 Ballot creation is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodcanCreateBallotWithRecordTypes
Description

Tests if this user can create a single Ballot using the desired record types. While VotingManager.getBallotRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Ballot. Providing an empty array tests if a Ballot can be created with no records.

Parametersosid.type.Type[]ballotRecordTypesarray of ballot record types
Returnboolean true if Ballot creation using the specified Types is supported, false otherwise
ErrorsNULL_ARGUMENT ballotRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetBallotFormForCreate
Description

Gets the ballot form for creating new ballots. A new form should be requested for each create transaction.

Parametersosid.type.Type[]ballotRecordTypesarray of ballot record types
Returnosid.voting.BallotFormthe ballot form
ErrorsNULL_ARGUMENT ballotRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form with requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateBallot
Description

Creates a new Ballot.

Parametersosid.voting.BallotFormballotFormthe form for this Ballot
Returnosid.voting.Ballotthe new Ballot
ErrorsILLEGAL_STATE ballotForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT ballotForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED ballotForm did not originate from getBallotFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateBallots
Description

Tests if this user can update Ballots. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Ballot 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 Ballot modification is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetBallotFormForUpdate
Description

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

Parametersosid.id.IdballotIdthe Id of the Ballot
Returnosid.voting.BallotFormthe ballot form
ErrorsNOT_FOUND ballotId is not found
NULL_ARGUMENT ballotId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateBallot
Description

Updates an existing ballot.

Parametersosid.voting.BallotFormballotFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE ballotForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT ballotForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED ballotForm did not originate from getBallotFormForUpdate()
CompliancemandatoryThis method must be implemented.
MethodcanDeleteBallots
Description

Tests if this user can delete Ballots. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Ballot 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 Ballot deletion is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethoddeleteBallot
Description

Deletes a Ballot.

Parametersosid.id.IdballotIdthe Id of the Ballot to remove
ErrorsNOT_FOUND ballotId not found
NULL_ARGUMENT ballotId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageBallotAliases
Description

Tests if this user can manage Id aliases for Ballots. 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 Ballot aliasing is not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodaliasBallot
Description

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

Parametersosid.id.IdballotIdthe Id of a Ballot
osid.id.IdaliasIdthe alias Id
ErrorsALREADY_EXISTS aliasId is already assigned
NOT_FOUND ballotId not found
NULL_ARGUMENT aliasId or ballotId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.