Interface RaceAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
RaceBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aRacefor the purpose of creating compatibility.booleanTests if this user can createRacesA return of true does not guarantee successful authorization.booleancanCreateRaceWithRecordTypes(Type[] raceRecordTypes) Tests if this user can create a singleRaceusing the desired record types.booleanTests if this user can deleteRaces.booleanTests if this user can manageIdaliases forRaces.booleanTests if this user can updateRaces.createRace(RaceForm raceForm) Creates a newRace.voiddeleteRace(Id raceId) Deletes aRace.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.getRaceFormForCreate(Id ballotId, Type[] raceRecordTypes) Gets the race form for creating new races.getRaceFormForUpdate(Id raceId) Gets the race form for updating an existing race.voidupdateRace(RaceForm raceForm) Updates an existing race.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
-
getPollsId
Id getPollsId()Gets thePollsIdassociated with this session.- Returns:
- the
Polls Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getPolls
Gets thePollsassociated with this session.- Returns:
- the
Pollsassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateRaces
boolean canCreateRaces()Tests if this user can createRacesA return of true does not guarantee successful authorization. A return of false indicates that it is known creating aRacewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifRacecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateRaceWithRecordTypes
Tests if this user can create a singleRaceusing the desired record types. WhileVotingManager.getRaceRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificRace. Providing an empty array tests if aRacecan be created with no records.- Parameters:
raceRecordTypes- array of race record types- Returns:
trueifRacecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-raceRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getRaceFormForCreate
RaceForm getRaceFormForCreate(Id ballotId, Type[] raceRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the race form for creating new races. A new form should be requested for each create transaction.- Parameters:
ballotId- a ballotIdraceRecordTypes- array of race record types- Returns:
- the race form
- Throws:
NotFoundException-raceIdis not foundNullArgumentException-raceIdorraceRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createRace
Creates a newRace.- Parameters:
raceForm- the form for thisRace- Returns:
- the new
Race - Throws:
IllegalStateException-raceFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-raceFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-raceFormdid not originate fromgetRaceFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateRaces
boolean canUpdateRaces()Tests if this user can updateRaces. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aRacewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifRacemodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRaceFormForUpdate
RaceForm getRaceFormForUpdate(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the race form for updating an existing race. A new race form should be requested for each update transaction.- Parameters:
raceId- theIdof theRace- Returns:
- the race form
- Throws:
NotFoundException-raceIdis not foundNullArgumentException-raceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateRace
Updates an existing race.- Parameters:
raceForm- the form containing the elements to be updated- Throws:
IllegalStateException-raceFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-raceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-raceFormdid not originate fromgetRaceFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteRaces
boolean canDeleteRaces()Tests if this user can deleteRaces. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aRacewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifRacedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteRace
void deleteRace(Id raceId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aRace.- Parameters:
raceId- theIdof theRaceto remove- Throws:
NotFoundException-raceIdis not foundNullArgumentException-raceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageRaceAliases
boolean canManageRaceAliases()Tests if this user can manageIdaliases forRaces. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifRacealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasRace
void aliasRace(Id raceId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aRacefor the purpose of creating compatibility. The primaryIdof theRaceis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another race, it is reassigned to the given raceId.- Parameters:
raceId- theIdof aRacealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-raceIdnot foundNullArgumentException-raceIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-