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

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

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

The delete operations delete Candidates. To unmap a Candidate from the current Polls, the CandidatePollsAssignmentSession should be used. These delete operations attempt to remove the Candidate 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.
MethodcanCreateCandidates
Description

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

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

Parametersosid.type.Type[]candidateRecordTypesarray of candidate record types
Returnboolean true if Candidate creation using the specified Types is supported, false otherwise
ErrorsNULL_ARGUMENT candidateRecordTypes is null
CompliancemandatoryThis method must be implemented.
MethodgetCandidateFormForCreate
Description

Gets the candidate form for creating new candidates. A new form should be requested for each create transaction.

Parametersosid.id.IdresourceIdthe resource Id
osid.id.IdraceIdthe race Id
osid.type.Type[]candidateRecordTypesarray of candidate record types
Returnosid.voting.CandidateFormthe candidate form
ErrorsNOT_FOUND resourceId or raceId is not found
NULL_ARGUMENT resourceId, raceId or candidateRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form with requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateCandidate
Description

Creates a new Candidate.

Parametersosid.voting.CandidateFormcandidateFormthe form for this Candidate
Returnosid.voting.Candidatethe new Candidate
ErrorsILLEGAL_STATE candidateForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT candidateForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED candidateForm did not originate from getCandidateFormForCreate()
CompliancemandatoryThis method must be implemented.
MethodcanUpdateCandidates
Description

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

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

Parametersosid.id.IdcandidateIdthe Id of the Candidate
Returnosid.voting.CandidateFormthe candidate form
ErrorsNOT_FOUND candidateId is not found
NULL_ARGUMENT candidateId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateCandidate
Description

Updates an existing candidate.

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

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

Deletes a Candidate.

Parametersosid.id.IdcandidateIdthe Id of the Candidate to remove
ErrorsNOT_FOUND candidateId not found
NULL_ARGUMENT candidateId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanManageCandidateAliases
Description

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

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

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