Interface CandidateBatchAdminSession
- All Superinterfaces:
AutoCloseable, CandidateAdminSession, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Candidates in bulk.
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
getCandidateFormsForCreate() specifying the desired race, resource, and
record Types or none if no record Types are needed. Each
of the returned CandidateForms 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 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.
The CandidateForms returned from
getCandidateFormsForCreate() may be linked to the originating request
through the peer Ids of the CandidateForm . In the case
where there may be duplicates, any CandidateForm of the same peer
Ids may be used for a create operation.
Once a batch of CandidateForms are submitted for create, a
CreateResponse is returned for each CandidateForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createCandidates() ,
errors specific to an individual CandidateForm are indicated in
the corresponding CreateResponse . CreateResponses may be
linked to the originating CandidateForm through the
CandidateForm Id .
For updates, CandidateForms are requested to the
Candidate Id that is to be updated using
getCandidateFormsForUpdate() where the reference Id in the
CandidateForm may be used to link the request. 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.
Once a batch of CandidateForms are submitted for update, an
UpdateResponse is returned for each CandidateForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateCandidates() ,
errors specific to an individual CandidateForm are indicated in
the corresponding UpdateResponse . UpdateResponses may be
linked to the originating CandidateForm through the
CandidateForm Id .
The delete operations delete Candidates in bulk. 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasCandidates(AliasRequestList aliasRequests) Adds anIdto aCandidatefor the purpose of creating compatibility.createCandidates(CandidateBatchFormList candidateForms) Creates a new set ofCandidates.Deletes allCandidatesin thisPolls.deleteCandidates(IdList candidateIds) Deletes candidates for the givenIds.deleteCandidatesForRace(Id raceId) Deletes candidates for the given race.deleteCandidatesForResource(Id resourceId) Deletes candidates for the given resource.Deletes candidates ineffective before the given date.getCandidateFormsForCreate(CandidatePeerList peers, Type[] candidateRecordTypes) Gets the candidate forms for creating a bunch of new candidates.getCandidateFormsForUpdate(IdList candidateIds) Gets the candidate forms for updating an existing set of candidates.updateCandidates(CandidateBatchFormList candidateForms) Updates existing candidates.Methods inherited from interface CandidateAdminSession
aliasCandidate, canCreateCandidates, canCreateCandidateWithRecordTypes, canDeleteCandidates, canManageCandidateAliases, canUpdateCandidates, createCandidate, deleteCandidate, getCandidateFormForCreate, getCandidateFormForUpdate, getPolls, getPollsId, updateCandidateModifier and TypeMethodDescriptionvoidaliasCandidate(Id candidateId, Id aliasId) Adds anIdto aCandidatefor the purpose of creating compatibility.booleanTests if this user can createCandidates.booleancanCreateCandidateWithRecordTypes(Type[] candidateRecordTypes) Tests if this user can create a singleCandidateusing the desired record types.booleanTests if this user can deleteCandidates.booleanTests if this user can manageIdaliases forCandidates.booleanTests if this user can updateCandidates.createCandidate(CandidateForm candidateForm) Creates a newCandidate.voiddeleteCandidate(Id candidateId) Deletes aCandidate.getCandidateFormForCreate(Id resourceId, Id raceId, Type[] candidateRecordTypes) Gets the candidate form for creating new candidates.getCandidateFormForUpdate(Id candidateId) Gets the candidate form for updating an existing candidate.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.voidupdateCandidate(CandidateForm candidateForm) Updates an existing candidate.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.
-
Method Details
-
getCandidateFormsForCreate
CandidateBatchFormList getCandidateFormsForCreate(CandidatePeerList peers, Type[] candidateRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the candidate forms for creating a bunch of new candidates. A candidate form is returned for each supplied race and resource pair.- Parameters:
peers- the candidate peerscandidateRecordTypes- array of candidate record types to be included in each create operation or an empty list if none- Returns:
- the candidate forms
- Throws:
NotFoundException- aresourceIdorraceIdis not foundNullArgumentException-peersorcandidateRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createCandidates
CreateResponseList createCandidates(CandidateBatchFormList candidateForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofCandidates. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
candidateForms- the candidate forms- Returns:
- the create responses
- Throws:
NullArgumentException-candidateFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCandidateFormsForUpdate
CandidateBatchFormList getCandidateFormsForUpdate(IdList candidateIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the candidate forms for updating an existing set of candidates. A new candidate form should be requested for each update transaction.- Parameters:
candidateIds- theIdsof theCandidate- Returns:
- the candidate form
- Throws:
NotFoundException- acandidateIdis not foundNullArgumentException-candidateIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCandidates
UpdateResponseList updateCandidates(CandidateBatchFormList candidateForms) throws OperationFailedException, PermissionDeniedException Updates existing candidates. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
candidateForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-candidateFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllCandidates
Deletes allCandidatesin thisPolls.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCandidates
DeleteResponseList deleteCandidates(IdList candidateIds) throws OperationFailedException, PermissionDeniedException Deletes candidates for the givenIds.- Parameters:
candidateIds- theIdsof the candidates to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-candidateIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCandidatesForRace
DeleteResponseList deleteCandidatesForRace(Id raceId) throws OperationFailedException, PermissionDeniedException Deletes candidates 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.
-
deleteCandidatesForResource
DeleteResponseList deleteCandidatesForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes candidates for the given resource.- 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.
-
deleteIneffectiveCandidatesByDate
DeleteResponseList deleteIneffectiveCandidatesByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes candidates 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.
-
aliasCandidates
AliasResponseList aliasCandidates(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aCandidatefor the purpose of creating compatibility. The primaryIdof theCandidateis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another candidate, it is reassigned to the given candidateId.- 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.
-