public interface RaceAdminSession extends OsidSession
This session creates, updates, and deletes Races. 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
Race, a RaceForm is requested using
getRaceFormForCreate() specifying the Ballot and
desired record Types or none if no record Types
are needed. The returned RaceForm 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 RaceForm
is submiited to a create operation, it cannot be reused with
another create operation unless the first operation was unsuccessful. Each
RaceForm corresponds to an attempted transaction.
For updates, RaceForms are requested to the Race
Id that is to be updated using
getRaceFormForUpdate(). Similarly, the RaceForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The RaceForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Races. To unmap a
Race from the current Polls, the
RacePollsAssignmentSession should be used. These delete operations
attempt to remove the Race 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 |
aliasRace(Id raceId,
Id aliasId)
Adds an
Id to a Race for the purpose of
creating compatibility. |
boolean |
canCreateRaces()
Tests if this user can create
Races A return of true
does not guarantee successful authorization. |
boolean |
canCreateRaceWithRecordTypes(Type[] raceRecordTypes)
Tests if this user can create a single
Race using the
desired record types. |
boolean |
canDeleteRaces()
Tests if this user can delete
Races. |
boolean |
canManageRaceAliases()
Tests if this user can manage
Id aliases for
Races. |
boolean |
canUpdateRaces()
Tests if this user can update
Races. |
Race |
createRace(RaceForm raceForm)
Creates a new
Race. |
void |
deleteRace(Id raceId)
Deletes a
Race. |
Polls |
getPolls()
Gets the
Polls associated with this session. |
Id |
getPollsId()
Gets the
Polls Id associated with this
session. |
RaceForm |
getRaceFormForCreate(Id ballotId,
Type[] raceRecordTypes)
Gets the race form for creating new races.
|
RaceForm |
getRaceFormForUpdate(Id raceId)
Gets the race form for updating an existing race.
|
void |
updateRace(RaceForm raceForm)
Updates an existing race.
|
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 canCreateRaces()
Races A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Race 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 Race creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateRaceWithRecordTypes(Type[] raceRecordTypes)
Race using the
desired record types. While VotingManager.getRaceRecordTypes()
can be used to examine which records are supported, this
method tests which record(s) are required for creating a specific
Race. Providing an empty array tests if a Race
can be created with no records.raceRecordTypes - array of race record types true if Race creation using the
specified record Types is supported,
false otherwiseNullArgumentException - raceRecordTypes
is null mandatory - This method must be implemented. RaceForm getRaceFormForCreate(Id ballotId, Type[] raceRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
ballotId - a ballot Id raceRecordTypes - array of race record typesNotFoundException - raceId is not foundNullArgumentException - raceId or
raceRecordTypes is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form with
requested record typesmandatory - This method must be implemented. Race createRace(RaceForm raceForm) throws OperationFailedException, PermissionDeniedException
Race. raceForm - the form for this Race Race IllegalStateException - raceForm already
used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - raceForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - raceForm did not
originate from getRaceFormForCreate() mandatory - This method must be implemented. boolean canUpdateRaces()
Races. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Race 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 Race modification is
not authorized, true otherwisemandatory - This method must be implemented. RaceForm getRaceFormForUpdate(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
raceId - the Id of the Race NotFoundException - raceId is not foundNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateRace(RaceForm raceForm) throws OperationFailedException, PermissionDeniedException
raceForm - the form containing the elements to be updatedIllegalStateException - raceForm already
used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - raceForm did not
originate from getRaceFormForUpdate() mandatory - This method must be implemented. boolean canDeleteRaces()
Races. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Race 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 Race deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteRace(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Race. raceId - the Id of the Race to
removeNotFoundException - raceId is not foundNullArgumentException - raceId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageRaceAliases()
Id aliases for
Races. 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 Race aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasRace(Id raceId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Race for the purpose of
creating compatibility. The primary Id of the
Race is determined by the provider. The new Id
performs as an alias to the primary Id. If the alias is
a pointer to another race, it is reassigned to the given race
Id. raceId - the Id of a Race aliasId - the alias Id AlreadyExistsException - aliasId is
already assignedNotFoundException - raceId not foundNullArgumentException - raceId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.