public interface BallotAdminSession extends OsidSession
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.
| Modifier and Type | Method and Description |
|---|---|
void |
aliasBallot(Id ballotId,
Id aliasId)
Adds an
Id to a Ballot for the purpose
of creating compatibility. |
boolean |
canCreateBallots()
Tests if this user can create
Ballots. |
boolean |
canCreateBallotWithRecordTypes(Type[] ballotRecordTypes)
Tests if this user can create a single
Ballot using the
desired record types. |
boolean |
canDeleteBallots()
Tests if this user can delete
Ballots. |
boolean |
canManageBallotAliases()
Tests if this user can manage
Id aliases for
Ballots. |
boolean |
canUpdateBallots()
Tests if this user can update
Ballots. |
Ballot |
createBallot(BallotForm ballotForm)
Creates a new
Ballot. |
void |
deleteBallot(Id ballotId)
Deletes a
Ballot. |
BallotForm |
getBallotFormForCreate(Type[] ballotRecordTypes)
Gets the ballot form for creating new ballots.
|
BallotForm |
getBallotFormForUpdate(Id ballotId)
Gets the ballot form for updating an existing ballot.
|
Polls |
getPolls()
Gets the
Polls associated with this session. |
Id |
getPollsId()
Gets the
Polls Id associated with this
session. |
void |
updateBallot(BallotForm ballotForm)
Updates an existing ballot.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getPollsId()
Polls Id associated with this
session. Polls Id associated with this sessionmandatory - This method must be implemented. Polls getPolls() throws OperationFailedException, PermissionDeniedException
Polls associated with this session. Polls associated with this sessionOperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateBallots()
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. false if Ballot creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateBallotWithRecordTypes(Type[] ballotRecordTypes)
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.ballotRecordTypes - array of ballot record types true if Ballot creation using
the specified Types is supported, false
otherwiseNullArgumentException - ballotRecordTypes
is null mandatory - This method must be implemented. BallotForm getBallotFormForCreate(Type[] ballotRecordTypes) throws OperationFailedException, PermissionDeniedException
ballotRecordTypes - array of ballot record typesNullArgumentException - ballotRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form with
requested record typesmandatory - This method must be implemented. Ballot createBallot(BallotForm ballotForm) throws OperationFailedException, PermissionDeniedException
Ballot. ballotForm - the form for this Ballot Ballot IllegalStateException - ballotForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - ballotForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - ballotForm did
not originate from getBallotFormForCreate() mandatory - This method must be implemented. boolean canUpdateBallots()
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. false if Ballot modification is
not authorized, true otherwisemandatory - This method must be implemented. BallotForm getBallotFormForUpdate(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
ballotId - the Id of the Ballot NotFoundException - ballotId is not
foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateBallot(BallotForm ballotForm) throws OperationFailedException, PermissionDeniedException
ballotForm - the form containing the elements to be updatedIllegalStateException - ballotForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - ballotForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - ballotForm did
not originate from getBallotFormForUpdate() mandatory - This method must be implemented. boolean canDeleteBallots()
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. false if Ballot deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteBallot(Id ballotId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ballot. ballotId - the Id of the Ballot to
removeNotFoundException - ballotId not foundNullArgumentException - ballotId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageBallotAliases()
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. false if Ballot aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasBallot(Id ballotId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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. ballotId - the Id of a Ballot aliasId - the alias Id AlreadyExistsException - aliasId is
already assignedNotFoundException - ballotId not foundNullArgumentException - aliasId or
ballotId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.