Interface BallotBatchAdminSession
- All Superinterfaces:
AutoCloseable, BallotAdminSession, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Ballots 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
Ballot , a BallotForm is requested using
getBallotFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
BallotForms 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 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.
The BallotForms returned from
getBallotFormsForCreate() may be linked to the originating request
through the peer Ids of the BallotForm . In the case where
there may be duplicates, any BallotForm of the same peer
Ids may be used for a create operation.
Once a batch of BallotForms are submitted for create, a
CreateResponse is returned for each BallotForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createBallots() , errors specific to
an individual BallotForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
BallotForm through the BallotForm Id .
For updates, BallotForms are requested to the Ballot
Id that is to be updated using getBallotFormsForUpdate()
where the reference Id in the BallotForm may be used to
link the request. 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.
Once a batch of BallotForms are submitted for update, an
UpdateResponse is returned for each BallotForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateBallots() , errors specific to
an individual BallotForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
BallotForm through the BallotForm Id .
The delete operations delete Ballots in bulk. 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasBallots(AliasRequestList aliasRequests) Adds anIdto aBallotfor the purpose of creating compatibility.createBallots(BallotBatchFormList ballotForms) Creates a new set ofBallots.Deletes allBallotsin thisPolls.deleteBallots(IdList ballotIds) Deletes ballots for the givenIds.getBallotFormsForCreate(long number, Type[] ballotRecordTypes) Gets the ballot forms for creating a bunch of new ballots.getBallotFormsForUpdate(IdList ballotIds) Gets the ballot forms for updating an existing set of ballots.updateBallots(BallotBatchFormList ballotForms) Updates existing ballots.Methods inherited from interface BallotAdminSession
aliasBallot, canCreateBallots, canCreateBallotWithRecordTypes, canDeleteBallots, canManageBallotAliases, canUpdateBallots, createBallot, deleteBallot, getBallotFormForCreate, getBallotFormForUpdate, getPolls, getPollsId, updateBallotModifier and TypeMethodDescriptionvoidaliasBallot(Id ballotId, Id aliasId) Adds anIdto aBallotfor the purpose of creating compatibility.booleanTests if this user can createBallots.booleancanCreateBallotWithRecordTypes(Type[] ballotRecordTypes) Tests if this user can create a singleBallotusing the desired record types.booleanTests if this user can deleteBallots.booleanTests if this user can manageIdaliases forBallots.booleanTests if this user can updateBallots.createBallot(BallotForm ballotForm) Creates a newBallot.voiddeleteBallot(Id ballotId) Deletes aBallot.getBallotFormForCreate(Type[] ballotRecordTypes) Gets the ballot form for creating new ballots.getBallotFormForUpdate(Id ballotId) Gets the ballot form for updating an existing ballot.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.voidupdateBallot(BallotForm ballotForm) Updates an existing ballot.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
-
getBallotFormsForCreate
BallotBatchFormList getBallotFormsForCreate(long number, Type[] ballotRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the ballot forms for creating a bunch of new ballots.- Parameters:
number- the number of forms to retrieveballotRecordTypes- array of ballot record types to be included in each create operation or an empty list if none- Returns:
- the ballot forms
- Throws:
NullArgumentException-ballotRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createBallots
CreateResponseList createBallots(BallotBatchFormList ballotForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofBallots. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
ballotForms- the ballot forms- Returns:
- the create responses
- Throws:
NullArgumentException-ballotFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getBallotFormsForUpdate
BallotBatchFormList getBallotFormsForUpdate(IdList ballotIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the ballot forms for updating an existing set of ballots. A new ballot form should be requested for each update transaction.- Parameters:
ballotIds- theIdsof theBallot- Returns:
- the ballot form
- Throws:
NotFoundException- aballotIdis not foundNullArgumentException-ballotIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBallots
UpdateResponseList updateBallots(BallotBatchFormList ballotForms) throws OperationFailedException, PermissionDeniedException Updates existing ballots. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
ballotForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-ballotFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllBallots
Deletes allBallotsin thisPolls.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteBallots
DeleteResponseList deleteBallots(IdList ballotIds) throws OperationFailedException, PermissionDeniedException Deletes ballots for the givenIds.- Parameters:
ballotIds- theIdsof the ballots to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-ballotIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasBallots
AliasResponseList aliasBallots(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aBallotfor the purpose of creating compatibility. The primaryIdof theBallotis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another ballot, it is reassigned to the given ballotId.- 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.
-